Problem in n8n loop node

I have problems with workflows where there is a loop in a loop, the 2ndory loop has issues, becauses it marks all incoming inputs as done before looping them. I even tried reset but it does not work, it only processes 1st input , everytrhing else is passe

  • Version 1.21.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via n8n cloud
  • Windows

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:

Hi Bhojraj, welcome to the community!

Could you please share your workflow here so we can take a look at it? Just click the ‘</>’ button and paste your code in.

Have same problem, reported issue in Git #8764

Hey @Bhojraj_Pilaniya,

Looping in a loop can be tricky, It looks like you have worked out part of the trick with multiple loops by looping back from the order table but there there are a couple of issues here, The first one is the initial loop will run more times than expected because the if branch is looping back as well as the airtable node.

If you look at the example below…

The top part will run the first loop node 6 times because it is one for each input +1 for the done output but the bottom branch that goes from the If like you have to the Loop is running 9 times which is the output from the Replace Me 2 + The output of the false Branch + 1 for the done output.

With the other part of this with the Loop outputting the data to done instantly this is likely to be because there are multiple executions coming in to the node like the example flow above. Typically we don’t recommend using nested loops like this as it can cause issues and a better way to handle it is to use a sub workflow so in this case you would move the second loop into its own workflow then call that workflow and you won’t need to loop back on it.

1 Like

Good news, This may be resolved shortly with this PR: feat(Loop Over Items (Split in Batches) Node): support multiple runs by elsmr · Pull Request #8777 · n8n-io/n8n · GitHub

1 Like