Lazy Switch¶
Selects and forwards one of two inputs based on a boolean switch, while lazily requesting only the branch that’s actually needed. This helps avoid computing or loading the non-selected branch.

Usage¶
Use this node to gate between two alternative values (e.g., models, prompts, images, parameters) based on a boolean condition. Connect heavy or expensive nodes to on_true/on_false so only the chosen branch is evaluated when the switch decision is made.
Inputs¶
| Field | Required | Type | Description | Example |
|---|---|---|---|---|
| switch | True | BOOLEAN | Condition that determines which input to forward. True selects on_true; False selects on_false. | true |
| on_false | True | WILDCARD | Value to output when switch is False. Marked lazy: it may remain uncomputed/unconnected until selected. | a text prompt value |
| on_true | True | WILDCARD | Value to output when switch is True. Marked lazy: it may remain uncomputed/unconnected until selected. | an image tensor |
Outputs¶
| Field | Type | Description | Example |
|---|---|---|---|
| value | WILDCARD | Pass-through of the selected input (on_true if switch is True, otherwise on_false). Type matches the selected branch. | the chosen prompt/image/value |
Important Notes¶
- This node is lazy: it requests upstream computation only for the branch required by the current switch value.
- Both on_true and on_false should resolve to the same kind of data to ensure downstream compatibility.
- If the selected branch is not connected or cannot be produced, the node will request it; unresolved inputs will cause execution to wait or fail upstream.
- The node does not alter or coerce types; it simply forwards the chosen input.
Troubleshooting¶
- Selected branch not connected: Ensure the branch corresponding to the current switch value is connected or can be produced when requested.
- Downstream type errors: Make sure on_true and on_false produce the same type/shape expected by downstream nodes.
- Unexpected None output: Check upstream nodes for errors on the selected branch and confirm they can produce a value when requested.
- Performance not improving: Verify heavy computations are placed behind the on_true/on_false connections so they are only triggered when that branch is selected.