Expression can access fields on an earlier node that were added only in a later node

I’m seeing an unexpected behavior in n8n’s data mapping / item linking and would like to understand if this is intended.

Minimal example

  1. Node 1 – Edit Fields (normalize)
    Output:

    [
      {
        "event": {
          "message": "hello world"
        }
      }
    ]
    
    
  2. Node 2 – Edit Fields (enrich)

    • Field event (object):
      {{ $('Edit Fields - normalize').item.json.event }}

    • Field event.enrich (string):
      this is a new text

    Output of Node 2:

    [
      {
        "event": {
          "message": "hello world",
          "enrich": "this is a new text"
        }
      }
    ]
    
    
  3. Node 3 – any node with an expression
    In Node 3 I can use:

    {{ $('Edit Fields - normalize').item.json.event.enrich }}
    
    

    and it successfully returns "this is a new text", even though event.enrich was only created in Node 2.

Questions

  • Is it expected that an expression referencing Node 1 ($('Edit Fields - normalize')) can access a field (event.enrich) that was only added in Node 2?

  • How does this interact with the documented item linking behavior and .item resolution?

  • From the engine’s point of view, what is the “true” data shape of Node 1 in this scenario – does it remain the original object without enrich, and the expression engine is providing some merged view, or is there another mechanism at play?

Please share your workflow

1 Like

yeah this is actually expected behavior - n8n uses item linking under the hood, so when you reference a previous node with `.item`, it automatically follows the linked chain forward and gives you the “latest version” of that item even if fields were added later.

so when you do `$(‘Edit Fields - normalize’).item.json.event.enrich` in node 3, n8n traces the item lineage from normalize → enrich and returns the enriched version. the original data in node 1 hasn’t changed, but `.item` resolution follows the links.

if you explicitly want the original shape from node 1 without later modifications, you’d need to use `.first()` or `.all()` instead of `.item` to get the actual output from that specific node. more on item linking here: Data structure | n8n Docs

lmk if that makes sense

1 Like

Thank you so much for the quick response!

Makes much more sense now.

Thanks again!

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