Hello is there any bug on loop node?

I execute the workflow and loop node arrow gives multiple done outputs..

1 Like

Hi @Robert_Hovhannisyan I think you need to elaborate your situation…

Also just for clarification the DONE branch of the loop node always outputs same number of items that were FED into it (previous node’s number of items) and this should be an expected behavior not a bug.

Read this if you want:

right, I will try to find a screenshot, but instead of pushing once, it does every time with the loop branch.. is it how it supposed to work?

@Robert_Hovhannisyan You are correct and that is expected behavior of Loop Node, the done branch triggers once per cycle, and the connected node to the done branch will execute the same number of times it is fed into the loop, and just not the one in the end, and if you want to store all the results you can use the aggregate node after done branch.

I have tried, but didn’t work for some reason, maybe I did something incorrect… this is to notify when it’s done.. on other workflows it works just fine, for some reason here it doesn’t..

thank you very much for your help

1 Like

@Robert_Hovhannisyan Can you share your JSON with us? Also you can try the Always Output Data mode on that node, and make sure that your aggregate node is not inside the loop itself but on the DONE branch of that loop

Thank you very much, yes, the aggregate is out of the loop, but still it outputs every time…

1 Like

@Robert_Hovhannisyan This is an expected behavior from DONE branch of the loop node as it will always output when 1 item is done processing which means if you gave 3 items it would put 3 items in the done branch after computing each one by one, and this is expected and this seems to be working fine what are you trying to achieve with this? And what problem you want to solve?

1 Like

so, I have multiple items which has to be filled on sheets, and when it’s done I want the workflow to notify through email and discord

1 Like

@Robert_Hovhannisyan Your current flow seems to be working… Other then one thing that i have spot which is that the LOOP branch only outputs 1 item.. Is that the problem here? This can happen due to some items not containing objects inside although currently your flow seems to be working fine and even you are getting notified 2 times that can also be your problem so to tackle this just use a code node that would send only 1 item and would compute 2 items coming from aggregate and so the code node’s output would be single item so your messaging sending nodes would only execute ones.

1 Like

Actually, this is what I wanted, before that I have merge node, I have two different lines which merge (that’s on purpose) but I also want the email to be sent only once

1 Like

@Robert_Hovhannisyan Just use a code node that would take all the input from aggregate and would create a single item which can be sent across both the messaging channels that would work.

1 Like

I see, after the aggregate or instead of aggregate?

1 Like

You can also skip the aggregate node and go straight to code node that would also work use claude to generate that code snippet and give claude the complete JSON you are receiving from DONE branch and then ask claude to make a javascript code to streamline this into 1 item and that would make it work so all those channels would only get executed once without compromising data.

1 Like

I see, thank you very much for your help

have a great rest of your day

1 Like

let me know if that works @Robert_Hovhannisyan and if that helped kindly mark that as a solution to appreciate it!

Cheers! Have a great weekend!

1 Like

sadly, it didn’t work :frowning:

1 Like

@Robert_Hovhannisyan as i can be some logic error in the code as it is not converting more objects into one, when you were using aggregate node is there any chance that you are trying to aggregate more than 1 item? Cause that is the only thing which have caused the error of aggregate node sending 2 items or more than 1 cause with one item aggregated it only output’s one item, with code node you can have to look around a bit with claude/chatGPT that how to write that code, using aggregate node with only one item aggregating can also be a fix.

2 Likes

So it worked, but the issue was on the previous loop nodes, they were executing and shooting outputs one by one and the next loop didn’t wait.

I disconnected the loop arrow and connected from DONE to the merge node, after which it feeds sheet node and aggregate node and eventually sends a message

thank you very much

2 Likes

so you were right about the aggregate node..

1 Like