Expressed resolves to undefined in multi item context

I’m referencing data from a previous node using $node[…].json, but inside a looped execution it resolves to undefined for some items. Is this due to item linking and execution data scoping?

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Need a reply on this

Exactly, this is an item linking issue

In n8n, each item maintains its own data lineage. When you access another node’s output, the system tries to resolve the corresponding paired item, not the entire dataset.

If the upstream node changed the item count (e.g., via Split In Batches, Merge, or aggregation), the linkage breaks.
Solutions:
Use:
JavaScript
Copy code $items(“Node Name”, 0, 0) to explicitly access a fixed item.
Or restructure the workflow to maintain item pairing.
This is not a missing field, it’s a data lineage mismatch.

2 Likes

Thought as much, thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.