Custom Node in n8n Not Iterating Over All Items from Previous Node

Hi there,

I’ve created a custom n8n node to call an API that requires JWT signing. The workflow is as follows:

  1. An API node retrieves a list of items.
  2. A SplitIn out node splits the results.
  3. the 3rd node should loop over the split items, using the “hostname” field from each.

The issue I’m encountering is that my custom node only processes the first item from the list and does not iterate over the remaining items. The expected behavior is for the node to loop through and process each item individually.

I’ve checked the output panel, and it shows that only the first item is being processed. There are no errors thrown, and the workflow settings seem to be correct.

Could anyone provide insights on what might be causing this behavior or what I should check to ensure my custom node processes all items in the list?

Thank you in advance for your assistance!

Information on your n8n setup

  • n8n version: 1.31.2
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Windows & Linux

will n8n automation loop the input and pass it into the node one by one, or does the node have to handle the node itself?

Hey @n1majne3,

Welcome to the community :cake:

The node needs to handle to the loop if you are not using the declarative style, You will see this in a lot of our nodes where we set something like items to this.getInputData() then loop over it.

without seeing the code is a guessing game, but seeing your workflow is pretty clear that you use the same node, first with no input (run once) then with the spitted output of the first node. So you have to deal with these two possibility in your execution code, or write two different custom nodes.
The thing to take in mind here is that even a node with no attached input is an array with one empty element.

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