Any Branch Switch (NH)
One input, five output branches, and only the branch you picked runs
- input
- output 0
- output 1
- output 2
- output 3
- output 4
- index
Most "switches" in ComfyUI pick one input to forward downstream. This one inverts the problem: it takes one input and routes it to one of five output branches - a fan-out valve instead of a fan-in valve. In the pack it's displayed as "Any Branch Switch (NH)", and honestly that name is doing the heavy lifting, because this is a branch router, not a picker.
The use case is when you have one value - a model, an image, a prompt - that should travel down different paths depending on a number you choose. Instead of duplicating the value into five branches and muting four of them by hand, you feed it once and set index.
How it works
Under the hood it's NH_AnyBranchSwitch. It takes input (any type - the * wildcard) and an index (0–4), then pushes the input to output index and puts an ExecutionBlocker on the other four. That blocked signal is the important part: it's not just "no data," it tells ComfyUI not to execute anything downstream of those outputs. So the sampler wired to output 2 genuinely doesn't run when you route to output 4 - you save the compute, not just the wiring.
The index input is a plain integer, which means you can drive it from a Counter (NH), a random node, or anything else that produces a number. That's the pattern that makes this node shine: a workflow that rotates through five styles or five upscalers per run, no manual toggling.
When to reach for it
- You have a batch of variants and want each queue run to take a different branch.
- You're building a menu-style workflow where a single number picks the path.
- You want conditional compute: blocked branches don't execute, so expensive branches only cost you when selected.
The trap to watch: unlike a first-non-null fallback, this node has no default. If index points somewhere you didn't intend, the selected branch runs - and if it's an empty-looking output, nothing downstream runs at all. There's no "if nothing matches, use branch 0" safety here, so clamp your index upstream if it comes from math.
Installing
Part of NH-Nodes - install the pack once and it's there:
cd ComfyUI/custom_nodes
git clone https://github.com/jetthuangai/NH-Nodes.git
cd NH-Nodes
pip install -r requirements.txt
Or search NH-Nodes in ComfyUI Manager and restart. Nothing else to configure, no models to download.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input | * | — | |
| index | INT | 00–4 | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| output 0 | * | — |
| output 1 | * | — |
| output 2 | * | — |
| output 3 | * | — |
| output 4 | * | — |
| index | INT | — |