Form Trigger fails in queue mode - Cannot read properties of undefined (reading 'execute')

Hi everyone!

I’m running n8n 2.21.7 in queue mode (EXECUTIONS_MODE=queue) with
PostgreSQL and Redis, hosted on Easypanel with Docker.

I built a workflow using a Form Trigger with responseMode set to
‘lastNode’, followed by an AI Agent node (OpenAI), and a Form
completion node to display the result on screen.

The workflow works perfectly when I test it manually inside the editor.
But when I submit the form in production, it fails immediately with this error:

“Cannot read properties of undefined (reading ‘execute’)”

The strange thing is that runData is completely empty when the error
occurs — it seems like it fails before any node even starts executing.
The stack trace points to bull@4.16.4 Queue.onFailed.

All my other workflows run fine in production. The issue seems specific
to the Form Trigger when it needs to keep the connection open waiting
for the last node response.

I already tried setting N8N_RUNNERS_ENABLED=false but the error persists.

Has anyone faced this before? Any ideas on what might be causing it?

Thanks!

this “Cannot read properties of undefined (reading ‘execute’)” pops up across different queue mode combos — "On form submission" trigger not working using the production URL · Issue #19317 · n8n-io/n8n · GitHub has the same pattern for form triggers on production URLs, and Postgres Node Fails in Queue Mode: “Cannot read properties of undefined (reading ‘execute’)” · Issue #15154 · n8n-io/n8n · GitHub hit it with Postgres in queue mode. #15154 got closed as “not planned” without a fix, so its an open n8n bug, not something on ur end.

worth trying as a workaround: switch the Form Trigger’s “Respond When” from “Workflow Finishes” to “Form Is Submitted”. u lose the live result display on the form page but the response goes back immediately on submit, which avoids whatever the queue handoff is doing wrong. have u tried that?

Hi @ricardo_balako

The error you are encountering, “Cannot read properties of undefined (reading ‘execute’)”, is a classic symptom of a communication breakdown in n8n’s queue mode. Because your workflow functions correctly within the editor but fails in production, the issue is almost certainly not with your workflow logic itself, but rather with how your distributed environment is handling the job. In queue mode, the primary instance sends a task to a separate worker process, and if that worker cannot properly initialize the required node, it crashes before it can even begin the execution.

The most common cause for this is a version mismatch between your primary instance and your worker instance. Even if both appear to be running the latest version, subtle differences in the underlying Docker images can prevent them from communicating correctly. It is essential to ensure that both services are explicitly using the exact same image tag and that you perform a full redeploy of both components simultaneously to ensure they are synchronized.

Another critical factor is the consistency of your environment variables across your infrastructure. Your primary and worker services must share the exact same configuration, particularly regarding the encryption key, database connection details, and Redis settings. If the worker lacks the correct configuration, it may fail to authenticate with your database or Redis, causing the “undefined” error when it tries to retrieve the workflow data it needs to start the job.

You should also verify that your worker service is configured to run specifically as a worker process. In your Easypanel setup, confirm that the command for your worker container is set to worker (e.g., n8n worker). Additionally, setting the environment variable N8N_REINSTALL_MISSING_PACKAGES=true on your worker is a good practice, as it ensures the worker has all the necessary dependencies, such as those required by the AI Agent node, which might be missing in a fresh worker environment.

The fact that the error points to bull (the queue management library) confirms that the failure is happening at the infrastructure level. The best way to get to the bottom of this is to ignore the main n8n logs and focus exclusively on the logs of the worker container at the exact moment you submit the form. These worker-specific logs will often provide the specific reason—such as a connection timeout or a missing dependency—that the job failed to initialize.

If you have verified the versioning, configuration, and logs and the issue persists, you may want to test by setting EXECUTIONS_PROCESS=main on your primary instance as a temporary diagnostic step. While this bypasses the worker infrastructure, it will confirm whether the problem is strictly related to the queue system. If the workflow runs fine in this mode, it confirms that your issue is isolated to the interaction between your primary n8n instance and the worker processes.

Welcome @ricardo_balako!

The root cause here is architectural: Form Trigger with responseMode=lastNode needs the main n8n process to hold the HTTP connection open until the workflow completes. In queue mode, the execution gets handed off to a worker - and that open connection cannot follow it across the process boundary. The Queue.onFailed in your stack trace confirms the job is dying at the queue level before any node even starts.

The fastest fix is what achamm suggested - switch “Respond When” to “Form Is Submitted.” If you need to display the AI result back to the user, a common pattern is to redirect them to a result page that polls a webhook or checks a status endpoint.

If you really need lastNode mode, the only clean option is to run those specific workflows outside queue mode - either with EXECUTIONS_PROCESS=main on the same instance (not recommended at scale) or on a separate n8n instance without queue mode enabled.

Also worth a quick check: confirm your worker container is on exactly 2.21.7 and shares the same N8N_ENCRYPTION_KEY - a mismatch there produces this exact failure pattern.

Worth confirming what was already hinted: this is a known n8n bug with form/webhook-style triggers in queue mode, not something wrong in your workflow. It works in the editor because manual execution runs in the main process, and fails on the production URL because in queue mode a worker picks it up and the trigger context is not wired the same way.

Practical paths until it is fixed upstream. If this one workflow does not need the scale of queue mode, run it in regular (main) execution mode and keep queue mode for the heavy workflows. If everything has to be queue mode, a common workaround is to split it: a plain Webhook node receiving the form post (webhooks behave better than the Form Trigger in queue mode), then handle the response separately rather than relying on responseMode lastNode through the form node.

Since the related GitHub issue got closed as not planned, do not wait on a fix. Subscribe to it for visibility but build around it now. Which n8n version exactly are you on, in case there is a regression window worth flagging.

Resolved! Here’s what worked for me:

The problem was exactly what @kjooleng described — a version incompatibility between my n8n services. I’m running n8n on Easypanel with three separate services: n8n_start, n8n_webhook, and n8n_worker. They were all running different versions of the Docker image, which caused queue communication to break before any node could even execute.

The fix was simple: I updated all three services to the same latest tag and redeployed them simultaneously. After that, everything worked perfectly in production.

Main takeaway: if you’re running n8n in queue mode with separate worker/webhook containers, make sure all services are on exactly the same version. Even a small difference between the main instance and the worker is enough to trigger this error.

Thanks to everyone for the help!