Nested Split into Batches Problem - Second Batch not using input data

Describe the issue/error/question

Although this is a large workflow, the problem is actually very simple - an issue with nested Split into Batches is all that’s going on here

Trying to set up a nested batch system using a solution offered by @harshil1712 here (How to use a nested split in batches?). There are two batches that get run:

  1. RSS_Batch
  2. Line_Batch

Consider two runs items passed through RSS_Batch (which will each fetch 15 RSS Feed items - 15 x 2 = 30 in total for both items):

For the first item, everything runs fine, no problem. Once we loop through RSS_Batch for a second time for second time, the first process runs fine.

But for the second process:

The first item (item 16) runs no problem through Line_Batch. Then it is the second item (item 17), which somehow fails to pick up the correct data for item 17 but takes the data from the Notion node instead; this causes it to error at 17.

I think, for some reason, it is not picking up the next item in Line_Batch when we run for a second time. Maybe this is due to how IF2 is configured (using {{!$node["Line_Batch"].context["noItemsLeft"]}} = true to reset the second loop as per @harshil1712 (How to use a nested split in batches?).

Would be very grateful for some feedback as to how to get the nested loops to properly operate on the second iteration.

Please share the workflow

Share the output returned by the last node


Errors because it cant find the correct data

Information on your n8n setup

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

Based on the example from @harshil1712 I think the IF2 outputs should be swapped so
trueNotion2 (RSS_Batch)

Then the reset param for Line_Batch should reference itself and not the RSS_Batch: {{$node["Line_Batch"].context["noItemsLeft"]}}


Worked a charm - thank you

Secondary problem which I’ve discovered:

Consider the IF node:

  • Now if all items pass through true, then there is one pathway back to the RSS_Batch (via the true pathway, no problem)
  • If any item passes through false; then we get multiple returns to RSS_Batch, which falsely re-initiates it

How do we set up the following:

  • If and only if there are no true items, then a single pathway back to RSS_Batch is initiated (to initiate the next sequence in the batch)

An alternative way of solving this could be:

  • Count number of items after RSS Feed → Check if the number of items in false = number of items after RSS Feed → If true pass one item back to the RSS_Batch

But not sure how to set-up!

Solved by using a double IF:


First if set to output all

second if set to check length of outputs;
→ if 0; return to batch (via false)
→ if > 0; continue to true

1 Like