Newbie Problem: Loop ends before every item has been looped

Describe the problem/error/question

I’m building a workflow with Salesforce integration where I first query some records and then loop over these records to query new records. I got about 350 results in the first query and I would expect the loop to perform about 350 times and to do additonal 350 queries to Salesforce. Instead the execution ends after 49 loops with a success message and without any trace why it ended sooner then expected.

Within these 49 loops the results look exactly as I want them to be. Maybe you have an idea why it stops after just 49 iterations.

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:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
1 Like

If the loop terminates prematurely, that most likely indicates that one of the nodes inside the loop haven’t produced the output. Look at the execution log and figure out which node it stopped at (it would have a number which is last node’s number minus one). Now investigate what was the input and whether no output is expected. If it’s expected and the workflow just needs to carry on and continue even with no output from that node - go to that node’s settings and enable the option “Always output data” - this will cause the node to produce an empty output (as opposed to no output) which will be enough for the loop to finish.

2 Likes

Wow Thanks a lot! That solved my problem! Thanks a lot :slight_smile:

No worries, if the issue is solved, kindly mark my answer as Solution. Thanks.

1 Like

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