Nodes/ComfyUI-H3-Multishot/H3 Any Switch (lazy A/B)
ComfyUI Node

H3 Any Switch (lazy A/B)

Flip a boolean and ComfyUI never even executes the other branch

By jlucasmcrell·Created 21 days ago·Updated 2 days ago· 31
H3 Any Switch (lazy A/B)
  • off_path
  • on_path
  • value
use_on

This is the switch you'll find all over the H3 Multishot workflow, and once you've watched it work you'll want one in every graph you build. It's a lazy A/B router: wire two paths into it, flip a boolean, and it passes exactly one through. The "lazy" part is what makes it worth using. The branch you didn't select doesn't just get ignored - ComfyUI never executes its upstream nodes at all. A switched-off feature costs zero compute and zero VRAM, which in this pack is the whole trick behind the VRAM/SPEED panel and the reference gates. An OFF gate passes its nothing through instead of erroring, which is how the shipped canvas stays queueable no matter what you toggle.

How it works

The mechanism is ComfyUI's lazy input system. off_path and on_path are declared lazy: true, so the node only asks the runtime for the one it's going to emit. If use_on is true you get on_path; otherwise you get off_path. Because both inputs are wildcard (*), you can route images, audio, latents, conditioning - anything - and the output keeps the type. That's why the same node gates a reference image lane in one graph and a model patch in another.

Three inputs, one output. The only one you touch day to day is use_on, a BOOLEAN (it's forceInput, so drive it from a Primitive or a switch node, or just click the toggle). off_path and on_path are the two candidate values. Output is value.

Where you'll hit it

In the bundled workflows, H3AnySwitch is the gate between a lane and the sampler. The REFERENCE gate and USE AUTO REFS both route through this pattern: with the gate off, the node emits the "nothing" side and the chain renders from prose alone - and because it's lazy, the LoadImage nodes upstream of the disabled branch never run, so you're not paying to load photos you're ignoring. It's the same reason all the speed-booster switches in this pack ship off without slowing anything down: a bypassed or gated patch on the off path never executes.

Install

It ships with the H3 Multishot pack, so install that once:

cd ComfyUI/custom_nodes
git clone https://github.com/jlucasmcrell/ComfyUI-H3-Multishot

or search H3 Multishot in ComfyUI-Manager (it's on the Registry as comfyui-h3-multishot). Restart ComfyUI. Requires ComfyUI v0.30.0+ for native MiniMax-H3 support. The pack's dependency list is deliberately empty - everything it imports already ships with ComfyUI.

Troubleshooting

The one thing that trips people up is expecting the unselected branch to still "validate." It won't - that's the point. If you have a node with a broken configuration sitting on the off path, ComfyUI won't complain about it while the gate stays off, which is both the feature and a subtle trap when you finally flip the switch. And remember the input order: boolean first, then off, then on. It's conventional, but when you're three hours deep into a chain, it matters that use_on = true returns on_path, not the other way around.

CategoryH3/episode

Inputs (3)

NameTypeDefaultDescription
use_onBOOLEAN
off_pathopt*
on_pathopt*

Outputs (1)

NameTypeDescription
value*