Nodes/ComfyUI-TinyBee/Null To String
ComfyUI Node

Null To String

The node that turns 'nothing' into an empty string so your workflow stops crashing

By TinyBeeman·Created about a year ago·Updated 10 days ago· 1
Null To String
    • string
    string

    In ComfyUI, None is a real, travelable value - but not every node agrees. Leave an optional input unwired and the upstream node may hand you a Python None. Some downstream nodes handle that gracefully; plenty just throw an error. Null To String is the fix for the most common case: it takes whatever comes in and, if it's None, hands back an empty string (""). If it's already a string, it passes it straight through.

    So the mental model is one line: if the value is nothing, make it an empty string; otherwise leave it alone. It's the mirror image of TinyBee's Empty String To Null, which does the reverse, and the two are meant to be bookends for the same problem.

    When you'd actually need it

    The realistic trigger: a node upstream has an optional input you didn't connect, and that node emits None down the wire. Or you're deliberately producing None - say with TinyBee's own Empty String To Null, which converts a blank prompt to None so it can act as a "this branch is off" signal to a first-non-null switch. When that branch is the one that's off, you end up with None where a text node expects a string, and that's the crash this node prevents. Slap Null To String between the source and any picky string consumer and the graph just runs.

    It's also handy as a prompt-feeding guard. Some CLIP text encoders and LLM nodes are fine with an empty string but genuinely unhappy with None. Rather than debugging a cryptic backend traceback at 1am, put Null To String right before the encoder - an empty prompt is a thing you can see and fix; a None is a thing you have to go hunting for.

    The input and output

    One required input: string (a STRING, marked force-input, so it's a socket not a widget), and one output, also string. Note the "force input" detail - there's no text box to type into here, this node is pure pass-through. It also sets IS_CHANGED to return float("NaN"), which is the ComfyUI idiom for "always rerun me." That matters because the node's input never changes while its meaning can depend on upstream state; the trade-off is that it defeats ComfyUI's cache for anything downstream, which for a node this cheap is a non-issue.

    Install and gotchas

    It's part of ComfyUI-TinyBee, installed all at once:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
    

    or via ComfyUI Manager by searching "ComfyUI-TinyBee". No model downloads, no heavy dependencies - the pack's requirements.txt only carries pillow and jsonata, and this node uses neither. If you find yourself needing the reverse direction - turning an empty string into a deliberate None - that's Empty String To Null, sitting right next to this one in the 🐝TinyBee/Casting menu.

    Category🐝TinyBee/Casting

    Inputs (1)

    NameTypeDefaultDescription
    stringSTRING

    Outputs (1)

    NameTypeDescription
    stringSTRING