Nodes/comfyui-misc/Any Output Switch (misc)
ComfyUI Node

Any Output Switch (misc)

The reverse switch that mutes everything except one destination

By wraith-executioner-year-2·Created 3 months ago·Updated 2 months ago· 1
Any Output Switch (misc)
  • input
  • any_01
select_index-1

Any Switch picks one of several inputs; Any Output Switch is the mirror image - it takes one value on input and routes it to exactly one of several outputs. The interesting part is what happens to the losers: instead of sending them anything, the node returns an ExecutionBlocker for every non-selected output. That's ComfyUI's signal to "don't run anything downstream of this socket at all," so the branches you didn't select are effectively muted at runtime without you bypassing them by hand.

That makes it the right tool for the "one source, many destinations, pick one" pattern: you have a single image and two or three downstream paths - maybe a Preview, a Save, and an upscale chain - and you want to decide per-run which one receives it without deleting and rewiring nodes.

The inputs. input is the wildcard * value to route, so it accepts anything. select_index defaults to -1, which routes to the first output slot that's actually connected. Set it to 0 or higher to force routing to any_{index+1} (0any_01, 1any_02, …), up to a cap that the frontend adjusts based on how many outputs you have wired.

The outputs. The dynamic any_01, any_02, … slots are the destinations - they appear as you connect them, and the node figures out its own slot layout by reading which outputs have links in the current graph (it gets that from the hidden prompt/unique_id inputs, not from guessing). The final output is index (INT), the 0-based number of the output that got the value, so a downstream node can log or branch on which path fired.

One implementation detail worth knowing: the non-selected outputs don't just receive None - they get an ExecutionBlocker. Downstream nodes connected to a blocked socket simply don't execute that run, which is stronger than passing an empty value through. If a branch must always run regardless of selection, don't hang it off this node; gate it somewhere else.

Install. Same as the whole pack, from ComfyUI/custom_nodes:

git clone https://github.com/wraith-executioner-year-2/comfyui-misc/

Restart ComfyUI; it lands in the misc category. No model files, no requirements to install - just a Python node and a web extension that keeps the dynamic slots in sync.

Where people get burned: the dynamic-slot bookkeeping is the fragile part. The frontend suppresses slot removal until links finish restoring after a load or copy-paste, and the changelog shows two separate fixes for output links not restoring on paste (v0.0.4, v0.1.1). So if you copy-paste a workflow containing this node and the second or third destination silently loses its link, that's a known class of bug in this kind of node, and the fix is usually to re-drag the connection. Also, remember only one output is active - if you route to a slot nothing's connected to, the value just goes nowhere, which is easy to miss when the graph doesn't visibly complain.

Categorymisc

Inputs (2)

NameTypeDefaultDescription
input*
select_indexINT-1-1–4096

Outputs (1)

NameTypeDescription
any_01*