ComfyUI Node

Bypass Switcher

A switch that flips itself when you mute or bypass a node

By slvslvslv·Created 2 years ago·Updated 7 days ago· 3
Bypass Switcher
  • input1
  • control1
  • value
  • selected_index

Bypass Switcher is the "stop rebuilding the graph to try the other thing" node. You give it a set of candidate inputs, each with a matching control input, and it returns the value from the first input whose control source node is connected and actively running. Mute or bypass that source node and the switcher silently moves on to the next candidate.

The trick that makes it interesting: the "control" input doesn't carry a value at all. You just wire any output from a node you care about into control1, and the switcher checks whether that node is on, muted, or bypassed by reading the workflow's node states. It's a conditional switch driven by your mute/bypass buttons instead of by a boolean widget you'd have to remember to update.

How it works

Internally it scans the workflow JSON for each controlN input, finds the source node, and checks its mode - 0 is normal, 2 is muted, 4 is bypassed. The first index whose control node is connected and not muted/bypassed wins, and the matching inputN is returned. Because the inputs are lazy, ComfyUI only evaluates the input that actually got selected - the losers are never computed, which also means no wasted generation from branches that aren't chosen.

The node dynamically grows: its input definitions are open-ended, so you can keep adding input2/control2, input3/control3, and so on, one pair at a time. There's no fixed cap in the schema, just the pairs you attach.

The inputs and outputs that matter

  • input1 - the value to pass through when control 1 is active.
  • control1 - wire any node output here; if that source node is active, input 1 is selected.
  • Outputs: value (any - whatever the winning input holds) and selected_index (INT - which one won, 0 when none did).

The selected_index output is the quiet star. It lets you log or display which branch ran, so a render's metadata can tell you "this one used variant 2" - useful when you're A/B-ing styles and want the receipt.

Where you'd reach for it

Classic use: a prompt or LoRA node that you sometimes want on, sometimes off, without editing the graph. Wire the toggle-able node's output into a control, put "with it" and "without it" values into the inputs, and you switch behavior by right-clicking → Mute on the source node. It's the same convenience that rgthree's group muters give you at the group level, here at the single-value level.

Installing it

It's part of SmartHelperNodes, so it installs with the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/slvslvslv/ComfyUI-SmartHelperNodes

Restart ComfyUI, or use ComfyUI Manager ("SmartHelperNodes"). No pip dependencies, no downloads.

Common issues

The whole mechanism depends on reading node states from the workflow, so it behaves correctly in ComfyUI's own editor but can lose its reference when you execute via the API without the full workflow payload - keep the workflow JSON in your request. And a control with no input wired is simply skipped, so a half-built switcher silently falls through to the next candidate; if nothing is active, you get None and index 0. Build the pairs deliberately and label them, or you'll be the one chasing a mystery None at 2am.

CategorySmartHelperNodes

Inputs (2)

NameTypeDefaultDescription
input1opt*Value to pass through when control 1 is active.
control1opt*Connect any node output here. If that source node is active, input 1 is selected.

Outputs (2)

NameTypeDescription
value*
selected_indexINT