Loop Over Items doesn't complete after reaching the expected number of iterations

Description:

Hi everyone, I’m facing an issue with the Loop Over Items node in my workflow on n8n.

Problem Information:

I’m using the Loop Over Items node to process a list of 482 items, which comes from a previous request.
The loop’s Batch Size is set to {{ $(‘Pesquisar Negocio’).item.json.Content.totalItems }} (which equals 482).
I expected the loop to finish after processing all 482 items, but the workflow continues looping and never triggers the done output.
The Loop Over Items node seems to be stuck in an infinite loop, even after reaching the defined number of iterations.
What I’ve tried:

I tested reducing the Batch Size to smaller numbers, like 10 or 20 items, but the issue persists.
Removed the No Operation, do nothing node that was after the loop, but it didn’t solve the issue.

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

hello @Automacoes_Fortlev

the expression { $(‘Pesquisar Negocio’).item.json.Content.totalItems }} won’t work. You’ll have to change it to { $(‘Pesquisar Negocio’).last().json.Content.totalItems }} otherwise it will be evaluated into 482 (for the first run) and undefined for the next runs

But why you even need to use the Loop node in that case? It’s the same as if there is no Loop node at all, as it will process all items in one run


I have the same problems, from the previous node I have 14 needed to be loop, the batch size is 1, so it should loops 14 times. But when it reaches 14, both “Done” branch is executed, and also the loop is stuck at the 15th time, which is weird