Conditional executed nodes break if node

Hello! I’m new to n8n and trying to figure out a simple case with an if statement.

Describe the problem/error/question

Im trying to decide on multiple steps if I should do X or Y.
I try to avoid calling things when not necessary (ex. call is in time every time even host is not available) and I don’t like to duplicate “get bulbs and turn off / on” nodes

Real case:
Turn bulbs on when host is reachable and time is between X and Y otherwise turn the bulbs off.

What is the error message (if any)?

Error message on not executed nodes “Referenced node is unexecuted”

Please share your workflow

Simple example workflow.

Share the output returned by the last node

I would expect that I can check on the last if node if both required nodes are true otherwise false.

Information on your n8n setup

  • n8n version: 1.35.0
  • Database (default: SQLite): postgres 16
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: Proxmox → VM:Debian 10 → Docker

hello @DarkStaR

You can’t refer to the nodes, that haven’t been executed. You will need to output both possible branches somewhere to refer to it later in the workflow

Change the first If Node’s condition to true/false to see how it works

1 Like

Thanks @barn4k! I got it to work with the “No operation” node and defining each required value for the last “if” node also in each “variable” node. Although it feels weird to set values in each variable node because one node shouldn’t contain necessary a value from a different node.

So there is no way to prevent an error on non executed nodes. For example by default non executed nodes-return value would be an empty object?

Currently there is no other way. If you will try to refer to any node, that hasn’t been executed, you will receive that error.

2 Likes

Sad to hear, that makes the whole automation process unnecessary more complex and you have to keep this always in mind when building a workflow with if nodes.

Thanks anyway for the help and the solution, I appreciate it!

1 Like

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