n8n-io/n8n

Drag-and-drop expression in n8n incorrectly generates references to node data

Opened this issue · 2 comments

Bug Description

When using the drag-and-drop feature to insert data from nodes that are 2 or more steps back in the workflow, the generated expressions are incorrect. The feature adds unnecessary .item references or other incorrect syntax, which causes the expressions to fail. This issue occurs specifically when trying to reference nodes that are not immediately before the current node in the workflow.
image
Red - using drag'n'drop
Green - manual editing

To Reproduce

  1. Create a workflow in n8n with multiple nodes.
  2. Add data-generating nodes (e.g., HTTP Request or Code nodes).
  3. In a later node, try to use the drag-and-drop feature to reference data from nodes that are two or more steps earlier in the workflow.
  4. Notice that the generated expression contains incorrect syntax, such as unnecessary .item references or other elements that cause errors like "Can't determine which item to use."

Expected behavior

The drag-and-drop feature should correctly generate expressions that use the proper syntax, such as
{{ $node.Configure.json.guild_id }} or {{ $node["Configure"].json["guild_id"] }}, without adding unnecessary .item or other incorrect parts.

Operating System

https://n8n.io/

n8n Version

1.57.0

Node.js Version

don't know

Database

SQLite (default)

Execution mode

main (default)

Hey @F4ntik,

We have created an internal ticket to look into this which we will be tracking as "GHC-214"

Hey @F4ntik,

The red is actually the "correct" syntax we changed it back in v1, When you try and run the node what error do you see as it could be that paired items is not implemented correctly in the node the data is coming from.

You can find more information on the syntax here: https://docs.n8n.io/code/builtin/output-other-nodes/#__tabbed_1_1