Nodes/ComfyUI-SwitchPathLazy/Switch Path (Lazy + Info)
ComfyUI Node

Switch Path (Lazy + Info)

A 2→1 switch that never runs the branch you don't pick

By ashtar1984·Created 9 months ago·Updated 9 months ago· 0
Switch Path (Lazy + Info)
  • on_true
  • on_false
  • output
statefalse

SwitchPathLazy looks like a dozen other switch nodes you've already seen: a boolean, two inputs, one output. The difference is in the name - the "Lazy" isn't marketing. Pick a path, and ComfyUI never executes the branch you didn't pick. No half-run, no wasted VRAM, no surprise API call.

That's the problem it actually solves. Plain switch nodes in ComfyUI route a value, but the graph still evaluates everything connected to it, so a "skipped" branch that runs an Ollama Generate, an external API, or a second slow sampler still costs you time and tokens. This is the flow-control family the KB files under "essential node packs" - same idea as rgthree's muters and bypassers - but where mute/bypass stops a node from running, lazy evaluation stops its entire upstream chain from being planned at all.

How it works

The node implements ComfyUI's native lazy evaluation API. Its check_lazy_status reads the current state and tells ComfyUI exactly which input it needs: state=true requires only on_true, state=false requires only on_false. ComfyUI then computes a minimal execution plan - the upstream nodes feeding the inactive input simply aren't queued, so a heavy branch you toggle off costs nothing.

There's a second safety net. If the inactive input somehow ends up populated anyway, the node returns an ExecutionBlocker, which tells everything downstream to stand down. Either way the wrong branch never produces a value. As a bonus it pushes a live readout under the node (state, active path, "lazy skip") via ComfyUI's progress-text API, so when you're debugging which path fired, you can see it without squinting at the wires.

The inputs that matter

  • state - boolean, defaults to false. The switch. Note the default: out of the box, on_false is the active path.
  • on_true / on_false - wildcard (*) inputs, so they accept any type: images, latent, conditioning, text, whatever. That flexibility means ComfyUI can't type-check for you; a mismatch only shows up at runtime.
  • output - wildcard, passes through whatever the active branch produced.

Wire output into whatever consumes the winner. Typical setup: two alternative pipelines feeding the two inputs, a boolean widget driving state, and the output feeding your sampler or save node.

Installing it

ComfyUI Manager is the easy route - search ComfyUI-SwitchPathLazy and hit install. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/ashtar1984/ComfyUI-SwitchPathLazy.git

Restart ComfyUI and it appears under the flow control category. That's the whole install: no model downloads, no requirements.txt, no external dependencies - the shipped code only imports ComfyUI's own server and comfy_execution.graph_utils. It's a small MIT-licensed pack by a single dev (ashtar1984, one commit in late 2025), a personal utility that happens to be public. Zero reddit footprint, zero drama - it just does the one thing.

Where people get burned

  • "Why isn't it skipping?" If the upstream node feeding the inactive branch is also consumed by some other node in the graph, it still runs - the graph has to satisfy that other consumer. The skip only applies to the branch's private upstream.
  • The state is decided at queue time. If you want the switch to react mid-run, feed state from a node that computes before the switch, rather than a hand-toggled widget.
  • The readout always claims the inactive branch is blocked, even when nothing is connected to it. Cosmetic, not a lie that matters.
Categoryflow control

Inputs (3)

NameTypeDefaultDescription
stateBOOLEANfalse
on_true*
on_false*

Outputs (1)

NameTypeDescription
output*