Nodes/ComfyUI-Stacker/StackPushObject
ComfyUI Node

StackPushObject

Stash any object — latents, conditioning, whatever — but know what you're signing up for

By concarne000·Created about a year ago·Updated about a year ago· 10
StackPushObject
  • object
    keydefault
    stackpath./ComfyUI/Stack/

    StackPushObject is the pack's wildcard. Where the other push nodes handle images, strings, ints, and floats, this one accepts anything - a latent, a conditioning, a face model, an entire batch of images - and writes it to a stack on disk so the next workflow can pull it back with StackPopObject. That sounds great, and it is, with one enormous caveat we'll get to.

    First, the inputs:

    • object - the any-type input. Wire whatever you want to carry across workflows. The output type is *, which means ComfyUI won't hold your hand about what it is.
    • key - the stack's variable name, default "default".

    stackpath defaults to ./ComfyUI/Stack/ and is fine to leave alone.

    How it works

    The node pickles the object - Python's built-in serialization - and writes it to a timestamped ._pkl file in ComfyUI/Stack/<key>/. On the other end, StackPopObject unpickles it back into a live Python object in your graph. The use case is exactly what the pack README describes: "image batches, latents, face models" - things that would be annoying or impossible to round-trip as PNGs or text, and that let a second workflow continue from a state the first one built.

    A detail that matters: the node always executes when the queue reaches it (it reports itself as changed every run), so a push always lands even if you think nothing changed.

    The security caveat - read this

    Pickling arbitrary Python objects is a code-execution vector. A malicious pickle file can run anything it wants on your machine when it's loaded - not "could theoretically," just does. That's why the author keeps the object stack disabled by default on the pop side: StackPopObject refuses to run until you create a dummy file named allow_generic_types.plz in your ComfyUI user folder.

    The push side, note, has no such guard. You can push pickles freely; the risk is in loading untrusted ones. The README's advice is worth quoting in spirit: keep the object stack disabled when you don't need it, and if you share or download workflows using it, understand that popping an object from someone else's workflow is like running their code.

    Install

    Same as the rest of the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/concarne000/ComfyUI-Stacker
    

    then restart ComfyUI, or search "ComfyUI-Stacker" in ComfyUI Manager. No models, and the only listed dependency is pickle - Python's standard library, so the install is trivial.

    Practical advice

    Only reach for StackPushObject when the typed nodes genuinely can't do the job. For images, prompts, and numbers, the Image/String/Int/Float nodes are safer and more debuggable - you can open their files in an editor. A pickle is opaque, version-sensitive (pickle across Python versions can break), and a security decision. It's a great tool for chaining a latent or conditioning between workflows you control end to end. For anything that came from someone else's machine or download, don't.

    CategoryConCarne

    Inputs (3)

    NameTypeDefaultDescription
    keySTRINGdefault
    object*
    stackpathoptSTRING./ComfyUI/Stack/

    Outputs (0)

    No outputs