Two branches to the same node doesn't work

I am trying to do what I consider something very simple - combine the output of two branches down to a single branch and act on the data - and it does not work the way I expect. This is almost certainly user error, but I can’t figure out what I’m doing incorrectly.

Consider the following example workflow:

We have a simple If statement whose decision sets a string variable, which is then passed to a REST call that creates a message in Slack.

However, in practice, with both the True and False branches connected to the REST call, the REST call will report Success but not actually do anything. As soon as we delete one of the paths, it works.

I feel like I am missing some fundamental way that n8n functions, which would explain why this workflow doesn’t function the way I think it should. This problem results in me having to create very convoluted, branched workflows in order to have multiple outcomes, when in theory I could have multiple branches converge to the same node. For example, I could have multiple branches to handle different conditions, but have them all converge to a REST node that sends a Slack message whose content is specified by a string in the input node.

I thought perhaps a Merge node would fix it:

… but that does exactly the same thing: if both paths are connected to the Merge node, the Merge node executes and reports success without returning any data. If only one node is connected, it works as expected.

I could use a Code node to make the choice - essentially moving the If statement into a code block and keeping a single workflow path - but I feel like this should work without resorting to Code node workarounds. This workaround also doesn’t help in more complex workflow situations, where I do legitimately need two or more branches that then converge down to one action.

What am I doing wrong?

  • n8n version: 1.24.1
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Linux

Edited to add the standard questions for posts in this forum. Sorry!

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @jkdeepnet! Thanks for reaching out. What you are describing is a known issue where if a node contains multiple parents, we (currently intentionally) pick the path without run data to start, and n8n just fails. Work is scheduled to begin on this soon, though the amount of work is high.

That said, the merge node is working based on how you’ve configured it. You may want to configure it so that it waits for both inputs to arrive however.

Here’s a modified version of your workflow where you can see one way to handle this.

2 Likes

Hi @Ludwig,

I really appreciate the reply!

It’s good to know I’m not missing something really obvious, and that this is a known issue.

Waiting for both branches doesn’t work for many of my workflows, but I’ll keep that in mind next time I encounter the issue.

Thanks again, I use n8n daily and it has made doing a lot of my job much more robust.

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