AIMZ Fallback Switch (Any Type)
Pick the first input that isn't None, and stop wiring bypasses
- primary
- fallback
- fallback_2
- output
This is a first-non-null switch with three inputs, and it's the closest thing this pack has to a programming-language or. It looks at primary, fallback, and fallback_2 in that order, and passes through the first one that isn't None. Nothing gets selected manually, nothing gets bypassed, no toggle to flip. If the first branch is dead, the next live one wins, automatically.
That's the whole mechanism, and it's exactly as simple as it sounds: a function that returns the first non-None argument. The power is in how you place it.
Why you'd reach for it
The ComfyUI_AIMZ pack is built around "None-safe" nodes - utilities that pass None through instead of crashing when an upstream branch produces nothing. That design only becomes useful if you have a node that responds to None. This is that node.
Say you have a conditional branch in a video workflow: sometimes your upscale pass produces an image, sometimes it legitimately produces nothing. Rather than bypassing nodes by hand and re-running, wire the branch into primary, wire a guaranteed fallback (a default image, a default prompt, a base model) into fallback, and the graph decides for you. This is the same family as rgthree's Any Switch, which states the contract as "chooses the first input that is not null/empty" - this is that idea with a third fallback level for deeper chains.
Inputs and outputs
All three inputs are optional and typed * - the ComfyUI wildcard that accepts any data type, IMAGE or LATENT or STRING or a model. So this one node serves as a fallback for everything. The output is output, same type as whatever came through. Whatever you wire into it, it preserves the type.
One subtlety worth knowing: this checks for None, not for emptiness. An empty tensor or an empty list is still "not None," so it will pass through rather than falling to the next input. If you need empty-checking rather than null-checking, this isn't the node - most of the time in ComfyUI, None is exactly the signal you care about, because that's what an unwired optional input and a dead branch both produce.
Installing it
Part of the ComfyUI_AIMZ pack. In ComfyUI Manager → Custom Nodes Manager, search comfyui_aimz, Install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/AIMZ-GFX/ComfyUI_AIMZ.git
No models, no extra dependencies - it's a few lines of Python.
Gotchas
The * wildcard input is the usual source of confusion. In the graph it renders as a socket that accepts anything, but ComfyUI still wants to know what type to show the output as. If you wire it into a strongly-typed input downstream and things get finicky, remember that the fallback node is type-erasing - it can't validate that the two branches carry the same type. Feeding a STRING into primary and an IMAGE into fallback won't be caught until the downstream node complains, not by this node.
If all three inputs are None, it outputs None. That's fine if your downstream is also None-safe - which, in this pack, is likely - but it's not a node that invents a default for you. The fallback chain is only as good as the last link.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| primaryopt | * | 1st Priority input. If not None, this value is passed through. | |
| fallbackopt | * | 2nd Priority input. Passed through if primary is None. | |
| fallback_2opt | * | Optional 3rd Priority fallback. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | * | — |