n8n 'Cannot Read Properties of Undefined' Error
Workaround available n8n Cloud, self-hosted Updated October 21, 2026
Quick answer
This error means a node or Code node tried to read a field from data that doesn't exist, often because a previous node returned nothing or a different shape. Inspect the input data, guard against empty items, and make sure workers run the same version.
Most likely fix: Inspect the input data.
Symptoms
A node or Code node fails with 'Cannot read properties of undefined (reading ...)', or the whole run fails with 'Problem running workflow'.
Why it happens
- Previous node returned no items or a different JSON structure
- API (e.g. OpenAI) returned an error or empty response
- Expression references a node that didn't run on this branch
- Main instance and queue workers on different n8n versions
How to fix it
Try these in order — the most common fix is first.
1. Inspect the input data
- Open the failing node and check the Input panel
- Confirm the field you reference actually exists
- Run the previous node alone to see its real output
2. Guard against missing data in Code nodes
- Use optional chaining, e.g. $input.first()?.json
- Check items.length before accessing items
- Return an empty array or default value when data is missing
3. Handle API errors before parsing
- Verify credentials and model or endpoint names
- Add retries on the API node (Settings > Retry On Fail)
- Add an IF node to skip empty responses
4. Align versions in queue mode
- Make sure the main instance and all workers run the same n8n version
- Update n8n to the latest stable release
This guide also covers
- n8n cannot read properties of undefined
- n8n code node error
- n8n problem running workflow
- n8n reading 'node'
Still not working?
If n8n keeps failing, you're not alone. See every n8n problem users report or the alternatives people switch to.
Other n8n errors
- n8n Webhook Not Registered (404 Error)
- n8n Webhook URL Shows localhost
- n8n Out of Memory (JavaScript Heap Out of Memory)
- n8n Connection Lost Error
- n8n Executions Stuck in Queued / Starting Soon
- n8n Google OAuth redirect_uri_mismatch Error
- n8n Schedule Trigger Running at the Wrong Time
- n8n Workflows Broken After 2.0 Update
- n8n Cloud Workspace Offline (503 Error)