First Not Empty
A two-input safety valve for 'use this, unless it's empty'
- first
- second
- value
First Not Empty answers one question: "is my first input carrying data? If not, use the second." It's a two-input version of the switch/fallback idea rgthree made famous with Any Switch, and it shows up wherever a workflow has a preferred source and a backup source. Wire the good thing into first, the fallback into second, and never think about it again.
It's part of the Open Creative Studio Nodes pack, and the README is upfront that it's based on rgthree's Any Switch. rgthree-comfy is the quality-of-life pack everyone installs second, after Manager - the ecosystem's canonical answer to "how do I make my graph not fall over when a node comes up empty." This node is that idea, stripped to the two sockets you actually use.
How it works
Both inputs are any-type (*), which is the magic that makes this node useful: you can wire in an image, a latent, a conditioning object, a string - anything. At execution, the node walks first then second and returns the first value that "has data." The emptiness check is smarter than a bare None check: it also recognizes a context dictionary (like a model+clip bundle) where every value is None, and treats that as empty too. So a "loaded model that didn't actually load" reads as empty, and you fall through to your backup instead of plumbing a broken object downstream.
If both inputs are empty you get None back, which most downstream nodes treat as "do nothing."
Inputs
- first - the preferred value.
- second - the fallback.
That's the whole input surface. No widgets, no dropdowns, no configuration. This is about as close to a zero-thought node as the pack gets, and that's the point.
Outputs
- value - whatever won. Any type, so it wires into whatever the two candidates would have fed.
Real uses
- Image fallback: "use the batch filter output if it has anything, otherwise show this placeholder." (It pairs naturally with the pack's Image List Filter and its fallback image.)
- Model fallback: "use the loaded model, but if the load produced nothing, use this default model."
- Prompt fallback: a specific prompt when available, a generic one otherwise.
Install
ComfyUI Manager → "Open Creative Studio Nodes" → install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/alessandroperilli/OCS_Nodes
No dependencies, no models, nothing to configure. If you've got Manager, it's a thirty-second install.
Gotchas
- It's not a switch. It picks the first non-empty value, it doesn't branch on a condition you control. For conditional routing you still want rgthree's actual Any Switch or a proper switch node.
- Only two slots. If you need a three-deep fallback chain, you can nest two of these -
firstinto one,secondinto the other'sfirst, fallback into itssecond. - The empty check is best-effort. A value that exists but is garbage (a corrupt latent, an all-black image) still counts as "not empty." It can't know an image is bad, only that it's present.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| firstopt | * | — | |
| secondopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | * | — |