Don't understand Code node output for "run once for all items" vs "run once for each item"

Hi. Can someone please explain to me why I can’t create an object in the code node and return it when it’s set to “run once for each item”?


ERROR: Unknown top-level item key: test [item 0]
Access the properties of an item under `.json`, e.g. `item.json`

I need to build a fairly complex object for each item and return that… I don’t understand why that’s possible in one mode and not the other. Any insight appreciated.

Information on your n8n setup

  • n8n version: latest.
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm,, desktop app]:
1 Like

Currently, the Run once for each item mode expects you to output the data in the format:

return { json : <your data> }

Ah nice. Thank you

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