IF nodes triggering with no input data

Hi everyone,

Describe the issue/error/question

For some reason, I have some IF nodes that are being triggered even though they have no input data, see below:

The two IFs should not be running, and it is stopping the Update contact 1 node from executing.
Btw, the IF nodes are returning [{}]

Thanks for your help

What is the error message (if any)?

None

Please share the workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 0.169.0
  • Database you’re using (default: SQLite): SQLite
  • Running n8n via n8n.cloud

Hi @maximpoulsen,

Welcome to the community :tada:

I suspect what is happening here is the merge node is checking to see what the value is of the previous node and to do that it needs to run it if it has not ran before. The merge node needs to have 2 inputs to work, I am sure this is something we can improve in the future but for now it may be worth thinking about another way to structure the workflow.

Hi @Jon,

Thanks for the quick reply! I thought the Merge node would only execute if it has 2 entries - not the other way around.

Do you know how I can prevent the HubSpot nodes from executing before the Find contact node?

Thanks!
Maxim

If I can also add, your answer doesn’t seem to cover why the Set Space went off though.

Set space went off because when the merge node triggered the if to get the second source it is using the value from the node above it looking at the expression which evaluated to true.

What is the workflow trying to do, there could be another way to handle it that is a bit neater. Are the merges even needed?

Ok, I understand, thanks!

I’m using the data from Find contact to update data in HubSpot (increment or append). So I just needed to be sure the node went off first. I added No Op nodes - this should fix the problem:

That looks better, You could remove the no-op nodes as well as you don’t really need them. If you look at output 2 on your switch node you are going to to the no-op node and to the update directly so that will in theory update twice which you may not want.

A real lazy way to handle it would be to have the Find Contact node in line so each of the 4 outputs calls that first before moving to the next step. It does mean the node is there multiple times but it will always work.

Sorry - missed the extra line for Output 2!
The problem with having the Find contact on every line is I lose the information from earlier in the workflow (the WF is triggered by a webhook), and I try to avoid using $node as much as possible.
Here I am using $node for Find contact though, but I’m only looking for 1 piece of information from it, instead of the 4-6 other keys from earlier in the workflow

Ah ok, I tend to use the $node option. Although in this case if you used that node in line as everything after isn’t changing the data you should be able to just use $json["value"] which may be easier.