ComfyUI Node

StackPopInt

Read the last saved integer off the stack — fallback, override, and peek built in

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

    StackPopInt pulls an integer back off a stack that StackPushInt filled, and hands it to your graph as an INT. In the classic two-workflow setup - workflow A renders, workflow B processes - this is how B inherits values like width, height, seed, or step count without hardcoding them. Push width on the A side, pop width on the B side, and the number walks across workflows like it was always there.

    The inputs mirror every pop node in this pack, and only a few of them matter most of the time:

    • key - the stack name. Must match the push side exactly, including capitalization.
    • stackmode - Normal (newest, deleted after reading), Peek (newest, kept), Pop Bottom (oldest, deleted), Peek Bottom (oldest, kept). Default is Normal, which makes each pop consume exactly one value.
    • fallback_enabled + fallback_item - an empty stack returns the fallback integer instead of stopping the run. Your best friend on the very first run, when the stack hasn't been filled yet.
    • override_enabled + override_item - skip the stack entirely and output a fixed value, consuming nothing. The author's use case: tweak a number for one generation without pushing a new stack.

    Output is a single INT.

    How it works

    Same mechanism as the other pop nodes: the stack is a folder of timestamped ._nu files under ComfyUI/Stack/<key>/. The node sorts them, takes the newest (or oldest, in Bottom modes), parses the number back into an int, and deletes the file unless you're peeking. LIFO by default, FIFO if you want it.

    The sharp edge is the same one everywhere in this pack: with fallback_enabled off, an empty or missing stack raises an exception and kills the run. And because Normal mode deletes after reading, a value consumed by a pop that's followed by a downstream error is gone - the README explicitly warns that pops before an exception stay popped.

    Install and gotchas

    Standard for 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, no dependency fights.

    Two reminders that apply here more than anywhere: pop is destructive by default (use Peek for reusable values), and an empty stack crashes by default (enable fallback_enabled for the first run). Both are one checkbox away from not being problems.

    CategoryConCarne

    Inputs (7)

    NameTypeDefaultDescription
    keySTRINGdefault
    fallback_enabledBOOLEANfalse
    override_enabledBOOLEANfalse
    stackmodeCOMBONormal4 options: Normal, Peek, Pop Bottom, Peek Bottom
    stackpathoptSTRING./ComfyUI/Stack/
    fallback_itemoptINT
    override_itemoptINT

    Outputs (1)

    NameTypeDescription
    INTINT