Error: Cannot read property 'node' of undefined

I’m using version 1.56.0 and I often encounter this error in various scenarios:
“Cannot read properties of undefined (reading ‘node’)”

[{"resultData":"1"},{"error":"2","runData":"3"},{"message":"4","stack":"5"},{},"Cannot read properties of undefined (reading 'node')","Error: Cannot read properties of undefined (reading 'node')\n    at Queue.onFailed (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/job.js:516:18)\n    at Queue.emit (node:events:531:35)\n    at Queue.emit (node:domain:488:12)\n    at Object.module.exports.emitSafe (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/utils.js:50:20)\n    at EventEmitter.messageHandler (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/queue.js:476:15)\n    at EventEmitter.emit (node:events:519:28)\n    at DataHandler.handleSubscriberReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:80:32)\n    at DataHandler.returnReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:47:18)\n    at JavascriptRedisParser.returnReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:21:22)\n    at JavascriptRedisParser.execute (/usr/local/lib/node_modules/n8n/node_modules/redis-parser/lib/parser.js:544:14)\n    at Socket.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:25:20)\n    at Socket.emit (node:events:519:28)\n    at Socket.emit (node:domain:488:12)\n    at addChunk (node:internal/streams/readable:559:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)\n    at Socket.Readable.push (node:internal/streams/readable:390:5)"]

@donchenko.pavel Can you reproduce this issue consistently? If so, can you please share your workflows that are triggering this? Thank you.

Hello, we have an instance of N8N running and are getting a similar error which we can replicate.
We are currently on version 1.57.0 and certain workflows that are triggered automatically (such as crons or webhooks) will run multiple times and output with the error described here.

It’s an odd one because the workflow will run, complete with a successful message and then it will run again and change to an error message.
Here is a very simple workflow which can create the error consistently:

It seems to be workflows that take a few minutes to complete will get picked up by another worker and be re-run:
image
image
image

[ScalingService] Added job 22863 (execution 25592)Error: Cannot read properties of undefined (reading 'node')    at Queue.onFailed (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/job.js:516:18)    at Queue.emit (node:events:519:28)    at Queue.emit (node:domain:488:12)    at Object.module.exports.emitSafe (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/utils.js:50:20)    at EventEmitter.messageHandler (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/queue.js:476:15)    at EventEmitter.emit (node:events:519:28)    at DataHandler.handleSubscriberReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:80:32)    at DataHandler.returnReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:47:18)    at JavascriptRedisParser.returnReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:21:22)    at JavascriptRedisParser.execute (/usr/local/lib/node_modules/n8n/node_modules/redis-parser/lib/parser.js:544:14) undefinedProblem with execution 25592: Cannot read properties of undefined (reading 'node'). Aborting.Error: Cannot read properties of undefined (reading 'node')    at Queue.onFailed (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/job.js:516:18)    at Queue.emit (node:events:519:28)    at Queue.emit (node:domain:488:12)    at Object.module.exports.emitSafe (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/utils.js:50:20)    at EventEmitter.messageHandler (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/queue.js:476:15)    at EventEmitter.emit (node:events:519:28)    at DataHandler.handleSubscriberReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:80:32)    at DataHandler.returnReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:47:18)    at JavascriptRedisParser.returnReply (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:21:22)    at JavascriptRedisParser.execute (/usr/local/lib/node_modules/n8n/node_modules/redis-parser/lib/parser.js:544:14) undefined

However both executions do succeed as I received two emails from this execution.
Hoping that all of this helps and we’re looking for a solution to this as it’s causing issues with data duplication in some workflows for us.

New version [email protected] got released which includes the GitHub PR 11438.