Nodes/ComfyUI-Stacker/StackPopObject
ComfyUI Node

StackPopObject

Unpickle the last object off the stack — behind a deliberate security wall

By concarne000·Created about a year ago·Updated about a year ago· 10
StackPopObject
  • fallback_item
  • override_item
  • any
keydefault
fallback_enabledfalse
override_enabledfalse
stackmodeNormal
stackpath./ComfyUI/Stack/

StackPopObject is the read side of the object stack - and the one node in this pack that won't run until you deliberately turn on a security switch. It takes the most recent pickled object that StackPushObject saved, unpickles it back into a live Python object, and outputs it as the any-type wildcard so you can wire it into whatever needs it. Latent in one workflow, latent out in the next. Same idea as the other pop nodes, with a much bigger warning label.

The gate: allow_generic_types.plz

Here's the thing you'll hit on first use: the node throws an exception with a message along the lines of "Generic object popping not allowed until dummy file allow_generic_types.plz exists in user folder." That file is your consent form. Create it in your ComfyUI user directory and the object stack unlocks.

# on Linux/macOS, from your ComfyUI directory:
touch user/allow_generic_types.plz

On Windows, create an empty file named allow_generic_types.plz in the user folder. That's it - then restart or re-run.

Why the ceremony? Loading a pickle can execute arbitrary code. The author shipped the object stack disabled by default on purpose, and the README is blunt about it: keeping it enabled while running other people's workflows is a security risk, and the advice is to either keep it disabled or change the node IDs if you fork the repo. If you only ever push and pop objects between workflows you control, the risk is minimal - that's the intended use. If you download a workflow that pops objects, you are, in effect, running someone's code.

The inputs (once unlocked)

Standard pop layout: key (stack name, must match the push side), stackmode (Normal, Peek, Pop Bottom, Peek Bottom - newest/oldest, delete/keep), fallback_enabled + fallback_item for empty stacks, and override_enabled + override_item to bypass the stack without consuming it. The output is a single any-type value - * - so ComfyUI won't check whether it's a latent, a conditioning, or a stray list. You're responsible for knowing.

How it works

The stack is a folder of timestamped ._pkl files under ComfyUI/Stack/<key>/. The node sorts them, takes the newest (or oldest, in Bottom modes), unpickles the file into an object, and deletes the file unless you're in a Peek mode. Same LIFO/FIFO mechanics as every other pop node - the only difference is the payload and the consent gate in front of it.

Gotchas

  • Unpickling is code execution. That's not FUD; it's the entire reason the gate exists. Only pop objects you or your own workflow pushed.
  • Pop is destructive by default. Normal mode deletes after reading, and a pop followed by a downstream error has permanently consumed the object.
  • Pickle is version-sensitive. An object pickled under one Python/ComfyUI version may fail to load after an update. It's a power feature with maintenance costs - use the typed nodes for anything they can carry.
CategoryConCarne

Inputs (7)

NameTypeDefaultDescription
keySTRINGdefault
fallback_enabledBOOLEANfalse
override_enabledBOOLEANfalse
stackmodeCOMBONormal4 options: Normal, Peek, Pop Bottom, Peek Bottom
stackpathoptSTRING./ComfyUI/Stack/
fallback_itemopt*
override_itemopt*

Outputs (1)

NameTypeDescription
any*