Text Input Auto Selector
A safe fallback for text that might come in blank
- STRING
A one-job node: check whether your primary text input actually has content, and if it doesn't, fall back to a backup string instead. Simple, but it fills a real gap - ComfyUI doesn't give you a native "use this unless it's empty" branch for text without wiring up something more elaborate.
What it's for
Auto-prompting and batch pipelines routinely have a step that sometimes produces nothing - an upstream caption model that occasionally returns an empty string, a conditional text node that's blank on certain branches, a user-facing field that isn't required. Feed that straight into a sampler and you generate off an empty prompt, which is rarely what you want. Wire it into component_input here instead, put a sensible default in alternative_input, and you get a graceful fallback instead of a silent failure mode.
It pairs naturally with this pack's other text nodes - chain it before ConcatTextOfUtils to guarantee a non-empty piece going into the join, or after ModifyTextGender if that node's output might come back blank in some edge case and you want a safety net.
Inputs and outputs
component_input- required, multiline. Your primary text source.alternative_input- optional. The fallback used whencomponent_inputis empty.
Output: a single STRING - whichever of the two actually got used, indistinguishable downstream from a direct text input. There's no separate signal telling you which branch fired; if you need to know that for debugging, check component_input yourself upstream rather than relying on this node to report it.
It's a smaller-scale version of the same idea behind ImageAutoSelector elsewhere in this pack, just for strings instead of images, and two levels deep instead of three - if your actual need is "try A, then B, then C," you'd chain two of these together rather than expecting a third slot on this node.
Installing it
ComfyUI Manager: search "ComfyUI-utils-nodes." Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/zhangp365/ComfyUI-utils-nodes
Restart ComfyUI. No dependencies, no configuration beyond the two fields.
The one thing to get right
Leave alternative_input disconnected and there's genuinely nothing to fall back to if component_input comes in empty - you'll just get an empty string out the other end, same as if this node weren't there at all. The value only shows up once you actually wire a real default into alternative_input; an unconnected optional input isn't a magic safety net, it just means there's no second option to reach for.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| component_input | STRING | — | |
| alternative_inputopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |