ComfyUI Node

String To Any

Sneak a string past a strict-typed input

By DemonAlone·Created 7 months ago·Updated 22 days ago· 3
String To Any
    • any_output
    input_string

    ComfyUI checks socket types when you wire two nodes together - a STRING output visually won't connect to an input that's typed something else, even if the value would work fine at runtime. String To Any is the standard workaround for that: it takes a plain string and re-emits it as a wildcard * type, which ComfyUI lets connect to almost anything, sidestepping the type check entirely.

    Why you'd need to bypass the type check

    This pattern shows up constantly once you start combining nodes from different packs. Say you've got a string value - a filename, a label built from PonyPrefixesNode or a concat node, a checkpoint name - and the node you want to feed it into declares its input as a generic or loosely-typed slot rather than a strict STRING. Sometimes that's intentional design on the receiving node's part; sometimes it's just how a pack chose to define its socket. Either way, wrapping your string through String To Any turns it into a type that will visually connect anywhere, letting the receiving node's own internal logic decide what to do with the actual value at runtime instead of ComfyUI's editor blocking the wire up front.

    It pairs naturally with this pack's other adapter nodes - Any to Float, Any to Integer, Any-to-Any Adapter - which all live on the same idea from the opposite direction: converting a wildcard back into something concrete. This one is the entry point into wildcard-land; those are the exits.

    The input and output

    • input_string (STRING, required, default empty) - the value you're converting.
    • Output: any_output, typed *.

    There's no transformation of the string's content - the value passed through is exactly what you typed or fed in. Only the declared type changes.

    How to install it

    ComfyUI Manager: search DemonAlone-nodes-ComfyUI, install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/DemonAlone/DemonAlone-nodes-ComfyUI
    

    then restart. No dependencies, no models - a pure type-relabeling utility.

    Common issues & troubleshooting

    Wiring it in didn't stop the "wrong type" error. Not every strict input can be defeated this way - some nodes still validate types internally at execution time even after a wildcard connection is allowed in the editor. If a node genuinely expects a number, a wildcard-typed string arriving at runtime can still error out; this node only gets you past ComfyUI's visual type check, not necessarily the receiving node's own logic.

    The downstream node did something unexpected with my text. Since the wire no longer carries an explicit STRING type, some nodes may treat the incoming wildcard differently than they'd treat a properly-typed string - read what the receiving node actually does with a wildcard input before assuming this converter is the source of the problem.

    Do I need this if the target socket already accepts STRING directly? No - if the input you're aiming at is already typed STRING, wire straight from your string source; this node only matters for the mismatch case.

    Which adapter do I actually want? If you're going from a specific type into a wildcard slot, this is the one you want for strings specifically. Going the other direction - wildcard back into a specific type - reach for Any to Float, Any to Integer, or a similar converter instead.

    Categoryutils

    Inputs (1)

    NameTypeDefaultDescription
    input_stringSTRING

    Outputs (1)

    NameTypeDescription
    any_output*