First Switch
The 'give me the first thing that actually exists' node
- values
- output
Nifty First Switch is the fallback chain node: you feed it up to 16 inputs of any type, and it returns the first one that isn't None. That's it. But "first non-None" is one of those tiny ideas that saves you from building the same three-node boolean nest over and over.
Think about what a fallback usually looks like in a manual workflow: "use the image the detector found, or if there isn't one, use the previous frame, or if that's missing too, use this static placeholder." That's a chain of if/else checks. Nifty First Switch collapses it into one node with a values input list - top input wins, and it checks top to bottom.
The lazy bit
The values input auto-grows as you connect more, and it's evaluated lazily: ComfyUI stops running inputs as soon as a non-None is found. If value1 is connected and present, value2 through value16 never execute. That matters when your candidates are expensive - a full sampler run as the "nice" option and a cheap placeholder as the last resort. The nice path runs only when it actually produces something.
Output: output - the first non-None value, or None if everything is empty.
Where it shines
- Optional-input handling. Feed it a detected image (which may be
None), then a cached/default image. One node instead of an Is None + Input Switch pair. - Progressive refinement. Try the high-quality path first, fall back to a faster one.
- Prompt/parameter fallbacks - strings work just as well as images, so a missing loaded setting falls back to a hardcoded default.
The main gotcha is the same one every lazy node has: an input that only exists to have a side effect won't run unless earlier inputs are None. If you need candidates to evaluate regardless, you want an eager variant - Nifty Nodes' logic suite is lazy/eager-paired throughout, and this one is the lazy member of the pair.
Install
ComfyUI Manager → search "Nifty Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Stibo/comfyui-nifty-nodes
Restart ComfyUI, and keep ComfyUI current - the pack runs on the new v3 API. Small pack, small community so far, but this node is a genuine quality-of-life win for anyone building conditional workflows. It reads like a gimmick and turns out to be the thing you wire into every second workflow.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| valuesopt | COMFY_AUTOGROW_V3 | Checks each input from top to bottom and returns the first one that is not None. Inputs are evaluated lazily — only as many as needed. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | COMFY_MATCHTYPE_V3 | — |