Nodes/ComfyUI Functional/[Internal] Deserialize
ComfyUI Node

[Internal] Deserialize

The hidden decoder behind Call Remote Function

By Duanyll·Created 11 months ago·Updated 4 months ago· 2
[Internal] Deserialize
    • *
    data

    [Internal] Deserialize is plumbing. It takes a string and hands you back a real Python object. That's the whole job. You'll almost never wire it yourself, but knowing it exists saves you a confused half-hour the first time you watch Call Remote Function work its magic.

    What it does

    One input, one output:

    • data - a string containing the serialized payload
    • output - the reconstructed object, typed * so it can be anything

    The format it decodes is the pack's own "whitelist" JSON scheme. Plain values like ints, floats, strings, bools, lists and dicts pass straight through. Everything fancier is tagged with a __type__ marker: set, tuple, bytes, numpy.ndarray, torch.Tensor, and PIL.Image (with binary blobs base64-encoded). The decoder reads those tags and rebuilds the object - for example, a tensor gets reconstructed from the saved bytes, and a numpy array from a .npy payload.

    Where you actually meet it

    This node is the return half of the pack's serialization story, and it's used in two places:

    1. Inside remote workflows. When you call Call Remote Function, the pack serializes your parameters and captured values, then injects a __Deserialize__ node into the workflow it uploads to the remote ComfyUI instance. The remote graph deserializes your params, runs the function body, serializes the result, and sends it back - which the caller then deserializes client-side with the same machinery.
    2. Manually, if you're poking around. There's a matching [Internal] Serialize node, and if you hand-craft serialized strings you can round-trip them through Deserialize to inspect what survived.

    If you're not doing remote calls, this node just sits there unused.

    When it matters to your debugging

    The error you'll actually hit comes from the serializer, not the decoder: "Cannot serialize…" from Call Remote Function. That means something you passed isn't on the whitelist - typically a model, sampler, or custom object. Remote calls only move basic types, bytes, numpy arrays, CPU torch tensors, and PIL images. The fix is usually to set capture = False on the Function End and load heavy things inside the function body instead of passing them in. Deserialize isn't the culprit; it just never received a valid payload.

    Installing it

    It ships inside ComfyUI Functional (Duanyll/comfyui_functional) - ComfyUI Manager, search "Duanyll/comfyui_functional", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Duanyll/comfyui_functional
    # restart ComfyUI
    

    No pip dependencies or model files. You only ever need this node in the loop when you use remote function calls, so treat it as infrastructure: trust it, and spend your time on the serialization rules instead.

    Categoryduanyll/functional/internal

    Inputs (1)

    NameTypeDefaultDescription
    dataSTRING

    Outputs (1)

    NameTypeDescription
    **