I'm having issues with my loop node

Hello,

Describe the problem/error/question

This workflow scrapes leads and their website. Then it sends the data into a loop where it scrapes different pages from their main webpage to then feed all that information to an LLM with the purpose of creating a personalized email for each lead. The problem is that I feed X amount of items (in this case 77) into a loop and it only loops twice when it should loop the same amount of items (77). I’ve tried all the settings in the loop node and nothing worked. I just get “the workflow has executed successfully”. I’ve also tried the workflow unpinned and with different scrapped leads, and the loop always stops after the second run.

What is the error message (if any)?

No error message

Please share your workflow

(If i paste the workflow the whole page freezes)

Information on your n8n setup

  • n8n version: 1.92.2
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via: n8n cloud
  • Operating system: macOS Sequoia v15.5

can you share the workflow using the option in reply menu. So that i could look further in it. That issue basically arises when the loop thinks that all the information has been processed or information is finished and it is due to several reasons.
image
This option , just paste the code here

Sorry if you got spammed with notifications with my previous replies, I couldn’t figure out how to post the whole code here, when all I had to do was unpin the data…

Ok ill check the error and figure out a solution ASAP…

can you please copy the json data of the output of the node before the loop node and send that to me for testing.

Also try this thing as well because you are using the split node after the loop node that is basically the logic issue here ,

Try using the spilt node before the loop node and then on each link the node will execute one by one

I had to put the data on a google doc because it’s too long to just paste it in here.

**Data that goes into the loop

Also, I did try moving around all the nodes and tried putting just the “split out” node before the loop and had the same problem.

Thank you for looking into this, it’s driving me crazy hahaha

ok ill look into it but dont forget to mark the solution, Thank You

Got your issue bro let me tell you what the issue is … first see the picture

This is your output right so see that you have used the filter ( if the url starts with “/” then proceed but you have used split node which splits the url and passes them one at a time to the next node. Whne the first url is “/cart” the workflow continues and then the data is processed but when moved to the next node the url starts from “#” which denies the filter and there is no output because the split node only passes one output ( link ) at a time. That is why when there is no output from the filter then there is no further data to run the workflow and the workflow stops without any error. Because when there is no data then the workflow doesnt show any error.
Thank you Please mark it as a solution.

1 Like

Oh I see, thank you so much the doubt was driving me nuts!
Just as a final question there is no difference if I let the “split out” node inside or outside right? I thought that if i did the split out and filtering inside the loop, it would only pass on the valid data.

Basically split out node is just used to allow the array data to be divided into parts and pass one by one , it doesnt perform any other function except this. So basically it depends on the flow of data where you should use the split out node, also it is preferred that you arrange the flow of data in such a way that split out node is used before the loop for better processing.

1 Like

Ahh I see, thank you for all the help! I can now properly fix the workflow by knowing the real problem and how split out works because I had a bad understanding of it.

1 Like

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