πͺ Switch latent
Flip between two LATENT paths with one boolean
- on_true
- on_false
- latent
This one does exactly what it says and nothing more, which is the appeal: you've got two LATENT sources feeding the same downstream (a VAE Decode, a second-pass sampler, whatever), and you want to flick between them without rewiring the graph every time. Switch latent is a boolean toggle that picks one and passes it through.
It's the LATENT-typed member of a small family Crystools ships - there's a matching Switch mask, and presumably string/image/conditioning variants documented in the README's Switch section, all built on the same idea. The reason a typed switch exists at all alongside the generic Switch from any node (also in this pack) is that ComfyUI's type system checks connections at graph-build time; a LATENT-specific switch guarantees the socket only ever accepts latents, which catches a wrong connection immediately instead of failing at execution.
How it works
There's no logic to speak of. It holds two LATENT inputs and a boolean, and outputs whichever input the boolean currently points to.
The inputs and outputs that matter
on_true/on_false- both required LATENT inputs. Wire your two candidate latents here - say, the output of a base KSampler into one and a hires-fix pass into the other.boolean- defaults totrue, so out of the box it's passingon_truethrough. Flip it and the output switches toon_falseinstead.- Output:
latent- whichever one won, ready to feed into your VAE Decode or next sampler stage.
How to install it
Through ComfyUI Manager: search crystools, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/crystian/comfyui-crystools.git
cd comfyui-crystools
pip install -r requirements.txt
You'll find it under crystools πͺ / Switch afterward. No models, no GPU dependency for this specific node - it's just boolean plumbing.
Common issues & troubleshooting
Honestly, there's not much to go wrong with a node this small. The one thing worth flagging for beginners: both on_true and on_false are required inputs, not optional - ComfyUI won't run the graph if either socket is left unconnected, even if you're only planning to ever use one branch. If you're prototyping and only have one latent source ready, you still need to plug something into the other slot (even a throwaway Empty Latent Image) or the queue will refuse to start.
The good news is you don't need to worry about the switch wasting compute on the branch you didn't pick: Crystools added "lazy switches" in version 1.24.0, using ComfyUI's lazy-evaluation support so the switch only triggers execution of whichever branch the boolean actually selects. Feed on_true from a cheap Empty Latent Image and on_false from an expensive upscale pass, flip the boolean to true, and the expensive branch simply doesn't run. That's worth knowing before you assume you need a separate bypass or group-muter just to avoid paying for both paths - with this node, you don't.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| on_true | LATENT | β | |
| on_false | LATENT | β | |
| boolean | BOOLEAN | true | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | β |