If Node execute true branch even when no true conditiion

Describe the issue/error/question

Hi, i’ve a strange behaviour on a IF node: the true condition is clearly not reached: see the execution below:

BUT the next node (the one branched to the True condition) is executed (and fail here, because it’s missing input datas since the true condition was not reached…)

2022-02-03 11.00.47 meryem.app.n8n.cloud d6d0a0a2a2b6

I’ve tried to rebuild the if from scratch but the error persists.

The if node is quite simple:

Information on your n8n setup

  • n8n version: 0.158.0 on n8n.cloud

For me it looks just fine, it return false you can see there green line with number of item
2022-02-03 11.00.47 meryem.app.n8n.cloud d6d0a0a2a2b6

On the first and second ss you see what would happened if would be true/false (not sure but I understand it that way, if I am wrong may some1 correct me, pls)

Please try add discord node to see what really happen, e.g.

Let me know if it’s helpful

My problem is the “new skus” node (the one in red), it should not be executed.

But I think I understood my problem: i’ve tried to reproduce it with a simple workflow:

webhook with enough data to go to true:

webhook with data to go to false:

In both case, the other branch is not executed which is fine, that’s what I want.

Now add a merge node in “wait” mode:

We can see that the IF node somewhat execute correctly the test : the green line if going to false with 1 item, the “true” line is grey.
BUT the GO YES node is executed.
I was not expecting that.

Clearly it’s because of the wait node.

If I replace the wait node by another standard node like this one: it’s fine again:

With this test, i’m not sure it’s a bug, perhaps I misunderstood the usage of the merge nodes.

Hi @Thomas,

you have a very interesting problem. I don’t know if your examples match your problem exactly. To merge 2 webhooks into one “If note”, then to separate them and finally to wait for the result of the other one - that is really impractical :sweat_smile:. Better would be one webhook and then check with one If.

The “Wait” and “No Operation” nodes behave correctly in my opinion. “NoOp” needs no further input in contrast to “Wait”. Wait also “knows” that input 1 will never get an input - but has a node before, which it triggers. In other scenarios this is very useful.

I am very interested in what the specific goal should be. Then surely a solution can be found. It doesn’t necessarily have to be the code, but a picture of the complete workflow could help a lot.

Translated with www.DeepL.com

The 2 webhooks, & no op nodes are here to try to isolate and illustrate my problem.

But In real life, the IF can be used to separate 2 use cases:
the go-yes node can be replaced by a series of nodes doning action ‘A’ on all datas matching IF node
the go-no node can be replaced by a series of nodes doing action ‘B’
and then we wait for the 2 branches before continuing.

this is pretty common in my workflows, but the problem here is to handle when one of the IF branch returns nothing. This should be fine (we just don’t execute the branch)

Yes you are right, the combination If and Wait are often used, but not in combination with 2 webhooks as “Start”. One webhook cannot wait for the other. That’s why “Merge” triggers the previous node.

Without knowing the workflow, the solution could be to use only one webhook and if necessary make decisions with the help of queries.

yes totally agree, the two webhooks here where only for test purposes.

The current workflow is pretty big, i’ve refactored to replace the “merge” nodes at the end (I added this merge node to wait for all the execution before sending a slack message).
I’m monitoring the executions to see if all the cases are ok now (seems fine for now).

Thanks for you help.

2 Likes