n8n - 💡(How to fix) Fix Merge node inside a sub-workflow breaks $('NodeName') expression resolution in the parent workflow [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
n8n-io/n8n#28618Fetched 2026-04-18 05:57:07
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
commented ×1labeled ×1mentioned ×1renamed ×1

Error Message

  • No error is thrown — the expression silently resolves to [undefined], which then breaks downstream branching logic (IF / Switch takes the wrong path). Error Demo.json
  • error: all
RAW_BUFFERClick to expand / collapse

Bug Description

When a sub-workflow (called via Execute Workflow) contains a Merge node on its execution path, expressions in the parent workflow that reference earlier parent nodes via $('NodeName').item.json... resolve to [undefined] in nodes placed after the Execute Workflow node.

Key observations:

  • No error is thrown — the expression silently resolves to [undefined], which then breaks downstream branching logic (IF / Switch takes the wrong path).
  • The Execute Workflow node's own output is unaffected. Referencing $json or the sub-workflow's returned data works fine.
  • Only back-references to parent nodes earlier than Execute Workflow via $('NodeName') are affected.

To Reproduce

Run the attached worklfow and check the Value in the node "Final Output". {{ $('Set Value').item.json.Value }} will resolv to [undefined]

Error Demo.json

Expected behavior

{{ $('Set Value').item.json.Value }} should resolve to "Text"

Debug Info

Debug info

core

  • n8nVersion: 2.16.1
  • platform: docker (self-hosted)
  • nodeJsVersion: 24.14.1
  • nodeEnv: production
  • database: postgres
  • executionMode: scaling (single-main)
  • concurrency: -1
  • license: enterprise (production)
  • consumerId: 23e998cf-d561-4ea2-a3d0-4b753bd59802

storage

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: database

pruning

  • enabled: true
  • maxAge: 50 hours
  • maxCount: 10000 executions

client

  • userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/147.0.0.0 safari/537.36
  • isTouchDevice: false

Generated at: 2026-04-17T12:52:33.395Z

Operating System

Windows 11

n8n Version

2.16.1

Node.js Version

24.14.1

Database

PostgreSQL

Execution mode

main (default)

Hosting

self hosted

extent analysis

TL;DR

The issue can be worked around by re-evaluating the expression after the Execute Workflow node or by using a different approach to access the parent node's data.

Guidance

  • The problem seems to be related to the scope and timing of expression evaluation in n8n workflows, specifically when using the Execute Workflow node with a Merge node in the sub-workflow.
  • To verify the issue, try logging the value of $('Set Value').item.json.Value at different points in the workflow to see when it becomes undefined.
  • As a potential workaround, consider using a Set node to store the value of $('Set Value').item.json.Value in a workflow variable before the Execute Workflow node, and then reference the variable instead of the original expression.
  • Another approach could be to restructure the workflow to avoid back-referencing parent nodes after the Execute Workflow node.

Example

No code snippet is provided as the issue is more related to the workflow structure and expression evaluation.

Notes

The root cause of the issue is not entirely clear, but it seems to be related to how n8n evaluates expressions and handles scope. The provided workaround may not be the only solution, and further investigation may be needed to find a more robust fix.

Recommendation

Apply workaround: The safest approach seems to be to use a Set node to store the value of $('Set Value').item.json.Value in a workflow variable before the Execute Workflow node, and then reference the variable instead of the original expression. This should help avoid the issue with back-referencing parent nodes.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

{{ $('Set Value').item.json.Value }} should resolve to "Text"

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

n8n - 💡(How to fix) Fix Merge node inside a sub-workflow breaks $('NodeName') expression resolution in the parent workflow [1 comments, 2 participants]