ComfyUI Node

Is String Empty

The one-check node that un-tangles your branches

By duckcomfy·Created about a year ago·Updated 10 months ago· 0
Is String Empty
    • is_empty
    string

    An empty prompt is a trap. You leave a text box blank, forget it's wired anywhere, and suddenly your workflow is running on empty or stale conditioning - or a switch is routing you down a branch you didn't mean to take. Is String Empty exists to make that state explicit. It's exactly one check: give it any string and it hands you a BOOLEAN telling you whether that string is empty, ready to feed a switch, a gate, or any conditional in your graph.

    Don't blink or you'll miss how it decides. The implementation is string == "" or string.isspace(). That second clause matters more than it looks: a field full of spaces counts as empty. So your "blank" prompt box with a few stray spaces in it still reads as blank, which is the behavior you actually want when you're gating on "did the user type anything."

    The inputs and outputs that matter

    There's one of each, which keeps this node honest:

    • string (STRING, required) - the text you're testing. It's a widget, so you can type straight into it, but you can also right-click and Convert widget to input to test a string that comes from elsewhere in the graph.
    • is_empty (BOOLEAN) - true when the string is empty or whitespace-only, false otherwise.

    The natural home for the output is any conditional or switch that branches on a boolean. The classic pattern: wire Is String Empty between a prompt box and a text switch, so an empty override box silently falls back to your default prompt instead of blanking it. It also pairs neatly with the pack's Two Text Concat, which skips empty inputs on its own - Is String Empty is for the cases where you want to react to the emptiness, not just survive it.

    How to install it

    This node ships in the duckcomfy personal nodes pack, a grab-bag of utilities that author duckcomfy re-implements to keep his own workflows dependency-light. Install it through ComfyUI Manager (search for "duckcomfy personal nodes"), or the old-fashioned way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/duckcomfy/duckcomfy_personal_nodes
    

    Then restart ComfyUI. There are no model downloads and the pack's pyproject.toml declares zero runtime dependencies, so this is one of the rare custom nodes that can't break your environment.

    Gotchas

    It only understands strings. The check does string.isspace(), so if you wire it something that isn't a string - say, a node that hands back None because its branch never ran - this will throw an AttributeError instead of returning true. If your upstream can produce None, guard it before it reaches here. And don't expect more than the binary test: there's no "contains only commas" or "has real words" logic, and no tooltip promises one. For a node this small, that's the whole point - it does one thing, unambiguously.

    Categoryduckcomfy

    Inputs (1)

    NameTypeDefaultDescription
    stringSTRING

    Outputs (1)

    NameTypeDescription
    is_emptyBOOLEAN