A8gent
All articles

Technical

Can't get data for expression: 5 Causes and the Fix for Each in n8n

n8n could not work out which item your expression is asking for. Usually a node upstream has not run, or .item cannot trace the current item back to the node you named. Here is how to tell the five cases apart and the exact expression change for each.

A8gentAutomation practiceNovember 17, 202611 min read
Contents
  1. The Short Answer
  2. What n8n Is Trying to Do
  3. Cause 1: A Node Upstream Has Not Run
  4. Cause 2: A Code Node Broke the Link
  5. Cause 3: More Than One Item Matches
  6. Cause 4: The Node Is on Another Branch
  7. Cause 5: The Node Has No Input
  8. Which Reference Method to Use
  9. How to Stop It Coming Back
  10. Sources
  11. FAQ

The Short Answer

"Can't get data for expression" appears when an expression refers to data n8n cannot retrieve. The n8n docs give the most frequent reason: the preceding node has not been run yet.

If the upstream nodes have run and you still get it, the expression is almost always using .item on a node further back, and n8n cannot match the current item to one item in that node. Two changes resolve most cases:

// Fails when n8n cannot trace the item back
{{ $('Webhook').item.json.body.email }}

// Works when the Webhook node output one item
{{ $('Webhook').first().json.body.email }}

Only use .first() when you really do want the first item. If the referenced node outputs many items and you need the matching one, fix the link instead. The sections below cover each case.

What n8n Is Trying to Do

In n8n you can reference data from any previous node, not just the one directly before. When you write $('Node Name').item, the earlier node may have output many items, so n8n has to decide which one you mean. The item linking documentation explains how: n8n maintains a thread back through the workflow's nodes for each item, recording which items in previous nodes generated it. To resolve .item, it follows that thread back until it reaches the node you named.

The docs list when that fails:

  • The thread is broken.
  • The thread points to more than one item in the previous node, so it is unclear which to use.
  • The node you reference is on a different branch from the current item.

Add the simple case, where the data does not exist yet because a node has not run, and you have the full list. The error panel tells you which one you hit. In the n8n source (workflow-data-proxy.ts) the title is paired with a field name and a description:

Text you seeGo to
Can't get data for expression under '<field>' field, with "Some intermediate nodes between ... have not executed yet"Cause 1
Referenced node is unexecuted, or Node '<name>' hasn't been executedCause 1, and our dedicated guide
Info for expression missing from previous node, or "The node '<name>' didn't return enough information"Cause 2
Multiple matching items for expressionCause 3
'<node-name>' is on another branchCause 4
"This node has no input data"Cause 5

Cause 1: A Node Upstream Has Not Run

This is the case the n8n docs lead with, and it mostly happens while you are building. You open a node, write an expression that reaches back three nodes, and the preview shows the error. Nothing is wrong with the expression. The nodes in between have no data yet, so there is no thread to follow. The source describes it in the error description: some intermediate nodes between the referenced node and the current one have not executed yet.

How to confirm it: look at the nodes between the one you referenced and the one you are editing. If any of them has no output from a run in this editing session, this is the cause.

The fix: run the workflow up to the node you are editing, then reopen it. The docs' advice is the same: test the workflow up to the named node. If one of the upstream steps is expensive or hard to trigger, pin its output so you do not have to call it again each time.

If the error persists in a real production execution, not only in the editor, the node was probably skipped by a branch. That variant is called "Referenced node is unexecuted" and has its own fixes, including the .isExecuted check, in our guide to that error.

Cause 2: A Code Node Broke the Link

The message for this one is "Info for expression missing from previous node". The docs explain it: there is a node in the chain that does not return pairing information. Most built-in nodes link every output item to an input item automatically. A Code node that builds new items from scratch does not, and neither do some community nodes.

How to confirm it: the error description names a node and says it did not return enough information. That node is a Code node or a community node sitting between the node you referenced and the node with the expression.

Fix A: return the link from the Code node. The n8n docs on preserving linking in the Code node say to set pairedItem when returning data, giving the index of the input item that produced each output item:

const out = [];
const items = $input.all();

for (let i = 0; i < items.length; i++) {
  out.push({
    json: { name: items[i].json.name.trim() },
    // index of the input item that generated this output item
    pairedItem: i,
  });
}

return out;

The docs note this only matters when the Code node receives more than one item. n8n handles linking automatically for single items.

Fix B: pass the value through. If you only need one or two fields from the earlier node, add them to the Code node's output and read them with $json afterwards. No link is needed for data that travels with the item.

For a community node, the docs are clear that the node's author has to update it to return which input items it used. Until then, Fix B or the position methods in the next section are your options.

Cause 3: More Than One Item Matches

The message is "Multiple matching items for expression". Some nodes build one output item from several input items. The docs name Summarize, Aggregate and Merge as examples. After one of those, a single item traces back to many, and .item has no way to choose.

How to confirm it: there is an Aggregate, Summarize or Merge node between the referenced node and the current one, and the node you are referencing output more than one item.

The fix, from the docs, is one of two things:

  • Use .first(), .last() or .all()[index] instead of .item. These read by position and do not use item linking.
  • Reference a different node that contains the same information but does not have multiple matching items. Often that is the aggregating node itself, read with $json.
// Second item from a node, by position
{{ $('Get Orders').all()[1].json.total }}

// Last item
{{ $('Get Orders').last().json.total }}

Be honest with yourself about whether position is what you want. If you aggregated fifty orders into one summary and then ask for "the order" that produced it, the question has no single answer. Decide which value you need and compute it in the aggregating step.

Cause 4: The Node Is on Another Branch

The message is '<node-name>' is on another branch. The node you referenced is upstream and did run, but the current item did not come through it. The docs give the standard example: a Merge node in Append mode outputs the items from Input 1 first, then the items from Input 2, and each output item still links back to only one input. If Input 2 comes from a node called Get orders, then {{ $('Get orders').item.json.total }} resolves for items that came from Input 2 and fails for items that came from Input 1.

There is a detail here that catches people out. According to the docs, in this case the expression resolves to null and the node still succeeds, so the execution does not stop. n8n shows the error in the expression preview in the editor. That means you can ship a workflow that runs without failing and writes empty values for half its items.

How to confirm it: two branches rejoin before the failing node, and the expression works for some items and is empty for others. Check the output of the node for null values in the affected field.

The fix, from the docs:

  • Use .first(), .last() or .all()[index] instead of .item, if a fixed position is what you want.
  • If a Merge node brought the branches together, set it to Combine mode, so that each output item contains data from both branches. Then read the value with $json.

Combine is usually the right answer. It makes the join explicit: you choose how items from the two inputs are matched, and everything downstream reads one complete item.

Cause 5: The Node Has No Input

The smallest case, and the n8n docs use it as their example for this error. An expression that depends on the node's input, such as $input.params, cannot resolve if you test the step without connecting it to another node:

{
  "my_field_1": {{ $input.params }}
}

How to confirm it: the node has no incoming connection, or the editor says the node has no input data.

The fix: connect the node to the one whose output it should read, run that node, then test again. It tends to happen right after copying a node from another workflow, where the expressions came along and the wiring did not.

Which Reference Method to Use

Most of these errors come from reaching for .item by habit. The n8n reference documentation lists the alternatives. This is how to choose between them:

ExpressionReturnsUse when
$jsonJSON of the current input itemThe value is on the item that just arrived. Always the first choice.
$('Node').item.jsonThe linked item in that nodeThe node output many items and you need the one that produced the current item.
$('Node').first().jsonThe first item that node outputThe node output exactly one item, such as a trigger or a config lookup.
$('Node').last().jsonThe last item that node outputYou want the final item of a list.
$('Node').all()Every item from that nodeYou need the whole list, or a specific position with [index].

In the Code node there is one more: the docs say to use $("<node-name>").itemMatching(currentNodeInputIndex) instead of .item when you need to trace back from an input item.

How to Stop It Coming Back

Carry data forward instead of reaching back. If a value from the trigger is needed six nodes later, include it in the items as they flow. $json never depends on item linking. This is ordinary data mapping hygiene and it removes most of this error class.

Use .first() for single-item sources, on purpose. Webhook payloads, a settings row, a single API lookup: these output one item. Reading them with .first() says what you mean and cannot break when a later node changes the item count.

Treat every Code node as a link risk. When you add a Code node that returns new items, add pairedItem at the same time, even if nothing downstream uses .item yet.

Check merged branches for nulls. Because the other-branch case does not stop the execution, add a quick check after any Merge in Append mode: run it and scan the output for empty fields before publishing.

Item linking is one of the less obvious parts of n8n, and it matters more once agents and loops are involved. We teach it with worked examples in the n8n AI Agents course. For a free starting point, see how to build AI agents with n8n, and for where n8n sits against other tools, our n8n platform review.

Sources

Checked against n8n's documentation, source code and community forum on 17 November 2026.

FAQ

What does "Can't get data for expression" mean in n8n?
n8n could not retrieve the data an expression refers to. Most often an upstream node has not been run yet. Otherwise the expression uses .item on an earlier node and n8n cannot trace the current item back to exactly one item there, because the link is missing, ambiguous, or on another branch.
What is the difference between .item and .first() in n8n?
$('Node').item returns the item in that node that produced the current item, which requires item linking to work. $('Node').first() returns the first item that node output, regardless of the current item. Use .first() when the node outputs a single item, and .item when you need the matching one of many.
Why does the error name a field such as 'Value' or 'Fields to Set'?
The message includes the parameter whose expression failed, in the form Can't get data for expression under '<field>' field. That tells you which box in the node to open. The description underneath tells you why it failed.
How do I fix "Info for expression missing from previous node"?
A node in the chain, usually a Code node, did not return pairing information. In the Code node, add pairedItem to each returned item with the index of the input item that produced it. Alternatively include the fields you need in the Code node's output and read them with $json.
Why does my expression return empty values after a Merge node without any error?
With Merge in Append mode, each output item links back to only one input. An .item reference to a node on the other input resolves to null for those items, and per the n8n docs the node still succeeds. Set the Merge node to Combine mode or use .first(), .last() or .all()[index].
Does this error only happen in the editor?
The not-yet-run case is mostly an editor problem and goes away once you run the workflow up to that node. The item linking cases are real and will fail or return empty values in production too, so fix the expression rather than ignoring the preview.

If this resonated

Module 02 is the long version of this post.

Eval set, refusal pattern, kill switch. Build it in a weekend.

All postsLast verified 2026-11-17

Done for you

Want this built for your business?

Tell us the workflow. We scope, build, and ship the agent with guardrails and the numbers to prove it worked. The scoping call is free.

Free scoping call. You own the code.

Request a scoping call