Switch node always output/continue issue

Describe the problem/error/question

When I have a switch node that it’s possible for an output to have empty output, the always output goes through the first output rather than the output that is empty

When always output is enabled, it should go down the output in question.
In the example below all outputs should have an output, the first 2 should be empty but still continue the flow.

Please share your workflow

Information on your n8n setup

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

Yeah this is a known bug with the Switch node, when “Always Output Data” is enabled it incorrectly pushes the empty item through the first output instead of through whichever output actually had no matches. There’s a GitHub issue tracking it here: Switch node always trigger its first node · Issue #17504 · n8n-io/n8n · GitHub

The workaround for now is to turn off “Always Output Data” on the Switch and instead add a No Operation node or similar after each output to handle the case where nothing comes through. Not ideal but it gets the job done until they fix the underlying routing logic.

2 Likes

For anyone else who comes accross here. the noop solution didn’t do anything for me.
So instead I replaced the switch with a series of filters.

This was so I could preserve the rule mode logic, it may not work for you but that’s how I solved it.

1 Like

The filter approach @kr-nn landed on is actually a solid pattern, and worth understanding why it works better here.

The root issue with “Always Output Data” + Switch is that it was designed to prevent downstream nodes from stalling when no items match — but the implementation routes that empty item through output 0 instead of through the specific output that received no matches, which is clearly wrong behavior. The GitHub issue #17504 tracks it.

The filter-per-output approach avoids this entirely because each Filter node independently evaluates items and only passes through items that match its condition. If nothing matches, that branch simply stops — which is the behavior you actually want. The tradeoff is that you lose the Switch node’s centralized rule management UI, but for production workflows it’s more predictable.

One thing to watch: if you need ALL items to eventually exit the flow even when a given branch gets nothing, you can add a Merge node at the end that waits for all branches. That way your downstream logic still runs even if some branches passed zero items through. Configure it in “Merge By Position” or “Combine” mode depending on your data shape.

The “series of filters” solution you landed on is exactly what I use too for any conditional routing where branch isolation matters.

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