Describe the problem/error/question
I have a workflow that has a switch to define a couple of variables and then two branches of the switch flow to the same Loop node (without being merged). This morning only the first branch was executed, the second branch simply went straight to done without going through the loop. Is that by design? What’s wrong with my Workflow?
What is the error message (if any)?
Please share your workflow
Share the output returned by the last node
Information on your n8n setup
- **n8n version:**1.14.2
- Database (default: SQLite): ?
- n8n EXECUTIONS_PROCESS setting (default: own, main): ?
- Running n8n via (Docker, npm, n8n cloud, desktop app): cloud
- Operating system: ?
Hi @Fernando_Taliberti, I am sorry for the trouble.
n8n will struggle keeping track of the correct loop iteration in such a scenario. Your first branch will pass on one list of items to the Loop node which it will then run through. Once the second branch arrives, the loop will have already completed the expected amount of loops determined when it first executed.
To avoid this you can use Merge nodes in “Append” mode to transform multiple item lists into one list, like so:
This way, your loop would run for every single item without having to write a custom reset logic.
Hope this helps!