How is pairedItem supposed to work in Code node?

Describe the problem/error/question

How is pairedItem supposed to work in Code node?

What is the error message (if any)?

To make sure expressions after this node work, return the input items that produced each output item

Please share your workflow

Share the output returned by the last node

[
{
“name”: “Jane Doe”
}
]

Information on your n8n setup

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

basically each output item must reference an input item. this is item linking mechanism

itemMatching() usage example | n8n workflow template .

1 Like

So can you explain why the error in my example workflow?

There is no error in the example you provided. it is odd definitely.

you send two item to code node

[
  
{
  
  
"name": 
"John Doe"
  
},
  
{
  
  
"name": 
"Jane Doe"
  
}
]

and in code node decides to return only the last one that would be “Jane Doe”

and paired it with the first input item.

in the example in my previous post i add a third node showing that item is linked to first item

item linking just created a chain between items in different nodes, it does not change data that you output in any way. “jane Doe” would be “Jane Doe” but underhood is linked to “john Doe” of the first node

If you want to likn Jane doe to Jane Doe of the first node pairedItem must be 1

So why do I get this warning? It’s like I’m not pairing at all:

I do not that sentence in my instance, but i don’t think that would be an error. it is more like a reminder

As i said, this workflow is definitely strange and i regarded it for just learning

And one more thing, most of the time it is not necessary to pair items manually because n8n do it automatically for you