I’m stuck on a common branching/merging pattern in n8n and would appreciate some help.
I use an IF node to split incoming orders into two types, each handled by a different API request. After processing, the results need to be merged back into a single flow.
The problem is that:
• Sometimes both branches produce items
• Sometimes only one branch produces items
Using a Merge node fails when only one branch has data.
Using Edit Fields node works when only one branch has data, but drops results when both branches output items.
What’s the recommended pattern in n8n to:
• handle optional branches (0–N items), and
• merge results without losing data when one or both branches run?
Is this best solved with Merge (pass-through mode), or a different design pattern altogether? Thanks!
Hey
I also got problem with the merge node, I came to post my problem and this is how I found your post.
The new version of merge node 3.2 doesn’t append the two branches, it outputs 2 branches.
I tested with an older merge node version 2, and the append works as wanted.
What happened with the merge node? Why append option creates two instances and doesn’t puts simply together?
@tigger139 I just realized my problem was exactly the same as yours!
Before I also used a set node to “merge” two branches and that’s why i have this Merge node error.
I wish there would be a possibility that merge node can continue without waiting for a branch that will never be executed or the set node can also merge this kind of double branches into one.
I’m responding with the same thing as on your previous post.
If there’s no data on one branch, the merge won’t wait indefinitely. If one branch is full and the other is empty, the merge in append mode will definitely continue its path.
@YannickDa this is 100% true when everything is linear.
I made some tests with simple set nodes, and it was always correct output.
If you have a function/node/batching that changes the linear line, than n8n can’t follow anymore.
It looks the problem appears after I’m using postgres insert node, with on conflict do something create new row.
I also use n8n in much more complex workflows and have never really had a problem with it.
If you can provide a small demo version of the problem, we’d be happy to help you, understand it and find solutions. Otherwise, I don’t really see where the problem lies, or perhaps I haven’t understood the issue you’re describing