[Merge node] still runs when there is no input to it?

Describe the issue/error/question

The behavior of my function node is strange, basically i have 2 paths which product data will be sent, 1 for brand A and brand B, on brand A’s path i have a function node to reformat the product codes and it is still being triggered even if the if node before it does not send any data to it?? It will then proceed to error out and stop the workflow, which is an example of what would occur if there was only data for one brand and not the other.

Why does it do this? I have tried changing to a split node and even so it will activate the node even if no data output is sent to the node. I would really prefer not setting continue on fail and always output data on every single node in each path, that just seems like a very improper way to do things.

Can you please help me understand why data flow behaves like this?

I have attached a test spreadsheet file which should reproduce this here at this link if anyone would be so kind to try it for me??

What is the error message (if any)?

No error just irratic

heres a visualization of the problem at hand

Please share the workflow

Share the output returned by the last node

Information on your n8n setup

-Latest version running on docker container

Okay I understand why this is happening now, I have the loop from product A run to Product Bs loop if it fails, because of this product B’s loop triggers the previous nodes of this failed product A path to run. this is why it is why the function node is running without any input.

Is my assumption correct??

Okay so that assumption was not correct it still behaves that way after making a separate loop, maybe because they are joined at the merge nodes they are asked to activate, however the opposite is not true when I test the case where there are only Product A data, it still runs to completion…?

okay so the solution was to give all of the nodes continue on fail + always output data privileges. but i still don’t like this but its all i got for the moment

Hi @Josh-Ghazi

Normally this happens with merge nodes requesting data.
Haven’t seen it like how you set it up, I think.

I’ve fixed it in de past by setting an if to check if there is input data (set a field to not is empty)

ps. nice to see that you are using the community node. :slight_smile:

1 Like

Thank you again for your input, Im loving the community node!!

Yes i dont think that the way i have used merge nodes are proper best practice. If only i could do it another way…

I guess what im really looking for is a community merge node that takes in more than 2 inputs and appends them into one data output, if some of the inputs are empty by the end of the execution it shall continue to merge without them. Is there something like that??

Hi @Josh-Ghazi

There is nothing like that, that I know of.
Would also be kinda difficult to make I think. As the UI will not allow unlimited inputs.
For the switch node, I created the Switch9000, but it is a dirty solution, which will not work with inputs.

edit: workflow-wise. It will probably be possible to combine those 2 paths you got there into one. I haven’t looked at it properly, but using set node to set parameters and using those could do the trick. Also simply appending it to a spreadsheet (no clue on what kinda data we are looking at) and then taking it from that spreadsheet onwards could also help you out.

1 Like

yes sounds like the proper way, I sort of implemented the set nodes inside the loops so that the workflow could still function, the way i had it before, if non of the items failed the workflow would not complete because it was always expecting something to fail.

its tricky working with nodes because it outputs data but at the same time it triggers the next node, theres no way to just send data without triggering or vice versa, so what ive done is use a if node and make an impossible criteria so that it will never trigger the next node but the data is still available.

I just noticed this:


Why do you have them connected here?

that was to send the products that were unsuccessful in that loop to the second loop to try and see if it would work there. but i did remove it and it still behaves that way so its definitely the merge node as you said earlier

Ah ok, was just very confused. :sweat_smile:

Also one more thing :slight_smile:
Having multiple inputs into a single node can cause some funky stuff.
The splitInBatches node was created for it, but some others might not always give you the outcome you would expect in a workflow.

1 Like

yes thats exactly right, i will keep that in mind next time because i hate having 2 executions of a workflow when there should only be one, this can cause havoc sending out several slack messages when 1 with all the data is sufficient

1 Like