Switch Latent Fallback π²
Choose between two latents without the switch dying on you
- on_true_fb
- on_false
- LATENT
Latents are the trickiest type to switch in ComfyUI, because they're just dicts with samples tensors and hidden metadata - wire the wrong thing and the sampler errors in the middle of a run. Switch Latent Fallback is the typed variant of the pack's fallback switch, built for exactly one job: pick between two latent branches without crashing when one of them doesn't exist.
What it does
Same fallback logic as the family:
boolean= True β outputon_true_fb.boolean= False β tryon_false; if it'sNone(bypassed, muted, disconnected), fall back toon_true_fband log it.
The inputs are LATENT-typed, which is the point. Latent size mismatches are a classic silent failure - if your two branches produce different-sized latents, a switch won't save you (the downstream sampler will still reject a mismatched one), but at least the type check keeps you from wiring a conditioning or an image into a latent socket and discovering it three nodes later.
The scenario it's made for
The img2img vs txt2img pattern is the canonical use: one branch starts from a real image (encoded to latent), the other starts from an empty latent. Toggle between "generate from scratch" and "regenerate from this image" by flipping the boolean, and when you bypass the img2img branch entirely the switch just hands back the empty-latent path instead of erroring. That's the whole pitch, and it works.
Same logic applies to choosing between a KSampler's output latent and a VAE-encoded one, or between two candidate sampling branches in a comparison workflow.
Inputs and output
boolean- which latent input has priority (default False).on_true_fb- the latent for True; also the fallback.on_false- the latent for False, if provided. Optional on purpose.- Output: a single
LATENT.
The fallback console message is informational. Silence it via the pack's settings if it gets chatty.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/DraconicDragon/ComfyUI-RyuuNoodles
Restart ComfyUI, or use ComfyUI Manager (search "RyuuNoodles"). No models, no extra dependencies.
Gotchas
Latent switching has a hidden landmine that isn't the switch's fault: two latents may have different sizes, and ComfyUI's latent dicts carry samples, masks, and sometimes noise_mask entries. If you switch between latents of different resolutions, downstream nodes will happily tell you it's fine right up until the sampler throws a shape mismatch. This node selects the latent; it doesn't reconcile them. Keep your two branches on compatible sizes, or run them through the pack's Scale To Multiple nodes first - that combination is where this switch earns its keep.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| boolean | BOOLEAN | false | True will output on_true_fb, False will try to output on_false. If on_false is not provided (e.g. the connected node is muted or bypassed), it will fall back to on_true_fb. A message will be printed to console if this happens. |
| on_true_fb | LATENT | The input to output if boolean is True. Will be used as fallback if on_false is not provided. | |
| on_falseopt | LATENT | The input to output if boolean is False. If not provided (e.g. the connected node is muted or bypassed), on_true_fb will be used as fallback and a message will be printed to console if this happens. This input is optional. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | β |