Batch size and removing item with splice, bug?

Describe the problem/error/question

I remove an item in a node code with the splice function if one condition is met. It works well if Batchsize >1
When batchsize =1, the process stops when condition is met, even if additional items should be processed.

What is the error message (if any)?

No error, … behaviour is different, depending on the value of Batchsize

Questions # Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node


If batchsize = 5, you get 4 outputs (correct result)
If batchsize = 1, process stops after the first raw is processed

Information on your n8n setup

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

@hsteph , it is not a bug. The Loop stops working when no item returned (per design).

When the batch size is one and you remove that item in the loop, you essentially stop it as no item is returned. If “removebill” node set to always return a value (here it will be an empty object returned), the Loop will continue running.

image

The problem, however, is the “finish” node will include the empty item and you would have to get rid of it yet again (that is remove the empty object), utilizing Filter, for example.

1 Like

Thanks for the clarification.

As I’m learning the solution, this is a very important point to understand. I understand the ‘by design’ technical approach that can be very different from the high level workflow logic.

So, in my case, removing items in a loop structure needs a different approach.

I will take care of this.

Thank you!

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