🎈LazySwitch2way
Two branches, only one gets run — the switch that skips work
- ON_TRUE
- on_true
- ON_FALSE
- on_false
- OUTPUT
- output
A plain boolean switch is a lie in ComfyUI. Wire two checkpoints into an A/B switch and ComfyUI still evaluates both branches - both models load, both CLIP encodes run, and only then does the switch pick one. That's fine when branches are cheap. It's a real problem when a branch is a second model load, a heavy LoRA stack, or a node that crashes your run.
LazySwitch2way is the honest version. Flip its boolean and the side you don't select never executes. No model load, no wasted VRAM, no crash from the branch you weren't using anyway.
How the laziness works
This is ComfyUI's built-in lazy-input mechanism, not magic. The node declares its inputs with lazy: true, and defines a check_lazy_status() method. When your boolean is true, the node tells ComfyUI "I only need ON_TRUE - skip the rest." The upstream nodes feeding ON_FALSE simply aren't queued. You can see it in the source: check_lazy_status returns the name of whatever selected input is still missing, and switch() just forwards whichever value it was given.
One quirk to make peace with: the node has doubled ports. There's ON_TRUE/ON_FALSE and on_true/on_false, and two outputs, OUTPUT and output. It's effectively two independent channels through one switch. You don't need to use all of them - pick one set and wire it, ignore the rest.
Inputs that matter:
- boolean - the switch. True routes the true branch, False the false branch.
- ON_TRUE / ON_FALSE - any type (
*): images, latents, models, strings, you name it.
Outputs:
- OUTPUT / output - the value from the selected branch.
Where it shines
The classic win is test-time routing: two checkpoints, two samplers, one boolean that decides which expensive branch runs. Because inputs are any-typed, it also routes non-tensor things most switches won't touch - model objects, conditioning, strings.
The community has a scar here worth knowing about: lazy switches can trip ComfyUI's subgraph-validation recursion bugs in some versions, and there's a standing workaround of running the GraphConstantFolder extension when that happens. If your lazy switch starts throwing "maximum recursion depth exceeded" on a subgraph-heavy workflow, that's the fix people reach for.
Installing it
It ships in Comfyui_LG_Tools. Easiest is ComfyUI Manager - search "Comfyui_LG_Tools", install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/LAOGOU-666/Comfyui_LG_Tools.git
pip install -r requirements.txt
Restart ComfyUI and you'll find it under right-click → 🎈LAOGOU → Switch. One pack-level note: these nodes were split out of a paid pack (LG_Node) - if you bought that before, contact the author for a version that won't clash.
Troubleshooting
- Node outputs nothing - you likely left the selected branch unwired. Lazy means it'll happily skip an empty branch and hand you
None; whatever's downstream needs to survive that. - Both branches still run - check that you're not feeding the same upstream into both the lazy input and another node, which forces evaluation.
- "Recursion depth exceeded" - the subgraph validation bug above; try GraphConstantFolder.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| boolean | BOOLEAN | true | — |
| ON_TRUE | * | — | |
| on_true | * | — | |
| ON_FALSE | * | — | |
| on_false | * | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| OUTPUT | * | — |
| output | * | — |