Execute command raises 'Cannot read properties of undefined (reading 'add')'

Describe the problem/error/question

Hi, when I execute a workflow via execute command I get the following error. The workflow is supposed to activate all workflows. The workflow raises error only when started via n8n execute --id ***, if I manually start the workflow it succeeds.

What is the error message (if any)?


Problem with execution 113886: Cannot read properties of undefined (reading 'add'). Aborting.
Cannot read properties of undefined (reading 'add') (execution 113886)
Error executing workflow. See log messages for details.

Execution error:
====================================
Cannot read properties of undefined (reading 'add')
TypeError: Cannot read properties of undefined (reading 'add')
    at ScalingService.addJob (/usr/local/lib/node_modules/n8n/dist/scaling/scaling.service.js:181:38)
    at WorkflowRunner.enqueueExecution (/usr/local/lib/node_modules/n8n/dist/workflow-runner.js:252:45)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WorkflowRunner.run (/usr/local/lib/node_modules/n8n/dist/workflow-runner.js:137:13)
    at Execute.run (/usr/local/lib/node_modules/n8n/dist/commands/execute.js:57:29)
    at Execute._run (/usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/command.js:302:22)
    at Config.runCommand (/usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/config/config.js:424:25)
    at run (/usr/local/lib/node_modules/n8n/node_modules/@oclif/core/lib/main.js:94:16)
    at /usr/local/lib/node_modules/n8n/bin/n8n:71:2

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.80.3
  • Database (default: SQLite): postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker deployed on AWS ECS
  • Operating system:
1 Like

Is the n8n instance running when you execute the command to start the workflow?
The N8N nodes uses the api of n8n. To use the api, N8N must be up and running.

Hi @Franz, yes, I connect to the running N8N container and execute the command. I can access the UI in the same time and workflows are executing.

Checking /healthz/readiness endpoint it returns { “status”: “ok” }

Is the Option **Save failed production executions: ** set to Save, or Do no save?
Maybe you can check if something is shown on the executions tab on the workflow.

Save failed production executions is set to Save.

When accessing the failed execution, nodes have no error and I can see the same error in the popup on right down.

The failed executions are the ones ran with n8n execute --id *** workflow, the successful ones are ran with click Test Workflow.


I encountered a bug and have a small PR here, if you are Self-Hosted you can patch according to the PR

1 Like

In case anyone else comes across this post looking for the same error message and the mentioned fix didn’t solve the issue, I’ve opened another issue (not related to CLI in this case, but to the queue mode):