Error: Cannot read property 'node' of undefined

Hi there!

Lately we are having a ton of these errors on different workflows:

UnhandledPromiseRejectionWarning: Error: Cannot read property 'node' of undefined
    at Queue.onFailed (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/job.js:516:18)
    at Queue.emit (events.js:327:22)
    at Queue.EventEmitter.emit (domain.js:467:12)
    at Redis.messageHandler (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/queue.js:444:14)
    at Redis.emit (events.js:315:20)
    at Redis.EventEmitter.emit (domain.js:467:12)
    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)
    at Socket.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:25:20)
    at Socket.emit (events.js:315:20)
    at Socket.EventEmitter.emit (domain.js:467:12)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)

It does not look like an error on the workflows implementation, but rather on the logic processing workers queues. Do you know what could be going on?

Our setup:

  • n8n version 0.163.1
  • We use queue execution mode with 25 workers at peak times

Hi @Miguel_Caballero_Pin, I am sorry to hear youā€™re having trouble here.

Unfortunately I am not very familiar with the queuing logic, but perhaps @krynble can take a look into this?

Hey Miguel.

This is a strange error. I canā€™t pinpoint a root cause for it and will have to investigate.

Are you seeing a weird behavior with executions showing as ā€œRunningā€ forever?

This issue has stopped happening all of the sudden, at this point. My guess is that this error is related with intense usage of n8n workers, as we were having more volume of executions than usual around that time.

Are you seeing a weird behavior with executions showing as ā€œRunningā€ forever?

@krynble I canā€™t tell if that is the case, as I did not have the chance to look at the executions when this was happening.

@krynble Unfortunately, the issues are happening again very frequently. Is there a way we can get more info?

I have this problem too, did you find a solution?

Hey @Clayton_Tavares,

Can we get some information on what you have set up? versions, database type and all that good stuff.

Hi guys, i worked with Clayton in analysis of this problem.
We had used the version 0.164.0 of n8n, with postgresql 9.6, but we have another enviroment with version 0.156.0 of n8n without this bug, then we realized a downgrade of n8n to version 0.156.0 and has solved our problem.
We dont identify incompability with migrations of DB in version 0.164.0. We hope help you with this.

@rubensviana That is great finding, thanks! I would add that we are at version 0.163.1, so the issue may not be related with the version 0.164.0. Although we tried to upgrade to 0.164.0 and it failed, so maybe the migration process did caused the issue even tho it could not be completed.

Unfortunately, we downgraded to 0.156.0 and we are still seeing the Error: Cannot read property ā€˜nodeā€™ of undefined error sporadically.

Hello @Miguel_Caballero_Pin

I created a pull request that might help us find what is happening. According to the error message, it seems like n8n was not able to find the data related to the workflow. I cannot say for sure whether this is the case since I was unable to reproduce the issue, but I added some logs that, if happen, can help us understand what is going on.

You can follow up here: Added logs and error catches for possible failures in queue mode by krynble Ā· Pull Request #3032 Ā· n8n-io/n8n Ā· GitHub

Should be merged and released on our next version.

1 Like

This is awesome! Thanks @krynble!

Got released with [email protected]

Perfect, i will give it a try soon. Thanks!

Hi guys,
any updates on this?

We are still facing this error: (we are running n8n v0.173.1 in queue mode on GKE 1.21)

Problem with execution 32397: Cannot read properties of undefined (reading 'node'). Aborting.
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

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:538:35)
    at Queue.emit (node:domain:475:12)
    at Redis.messageHandler (/usr/local/lib/node_modules/n8n/node_modules/bull/lib/queue.js:444:14)
    at Redis.emit (node:events:526:28)
    at Redis.emit (node:domain:475:12)
    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)
    at Socket.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/ioredis/built/DataHandler.js:25:20)
    at Socket.emit (node:events:526:28)
    at Socket.emit (node:domain:475:12)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

If we try to run again the same workflow, it runs fine.

Thanks!

Sorry for the delay on my side. We are still seeing this issue as well after updating. I also saw n8n crashing after this error happened. Is there any way we can give you more info @krynble?

Iā€™m also seeing this same issue on most of my workflows. Iā€™m on version 0.181.2

Any help on this issue?

Hey people, sorry about the delay - we will investigate the issues mentioned. The problem we are having is that we were unable to reproduce the issue so far.

Could you provide some more information such as:

  • Number of currently active workflows
  • Average number of simultaneous executions (10 per second, 5 per minute, etc)
  • What triggers do you use the most (Webhook trigger or others)
  • Other nodes you might be using, such as Hubspot, HTTP Request, Slack, etc.

Thank you!

Also getting this issue.

1 active workflow. average number simultaneous is 1 per 5 seconds.

The one Iā€™m getting the error on is a manual execution.

I am using Sheets, batch, http request, html extract, and wait.

I am facing same issue with latest version of n8n (0.185.0). These errors are typically observed when workflow execution requests are triggered at high frequency (e.g. interval node triggering workflow execution every 1 or 2 seconds and each execution taking around 10 seconds (run time)). As I reduce trigger frequency to 5 seconds or 10 seconds, the errors start to reduce. I have 2 worker instances in my set up.