StackPopString
Grab the last saved string off the stack — or make the pop not destructive
- STRING
StackPopString is the counterpart to StackPushString: it reads a string back out of a stack and hands it to your graph as a STRING, ready to plug into a CLIP text encoder, a filename pattern, a metadata field, anywhere you'd use text. In a two-workflow setup where workflow A renders and B processes, this is how B learns the prompt A used without you retyping it.
The input list looks intimidating at first - four required booleans and an enum - but you'll realistically touch two or three of them.
The inputs that matter
- key - the stack name (default
"default"). Match it to the push side or you'll pop from a different stack than you think. - stackmode -
Normal(newest, deleted after read),Peek(newest, left in place),Pop Bottom(oldest, deleted),Peek Bottom(oldest, kept). If you're wondering when to leave Normal: when you want each pushed value consumed exactly once, like draining a queue of prompts across runs. - fallback_enabled + fallback_item - an empty stack returns the fallback value instead of killing the run. Handy for the first run, when the stack has nothing in it yet.
- override_enabled + override_item - bypass the stack and just output the override string. The author's example: you want to try a different prompt on the same already-pushed stack. Nothing gets consumed.
The output is a single STRING - the popped value, ready to wire onward.
How it works
The stack is a folder of timestamped ._st files at ComfyUI/Stack/<key>/. The node sorts the files, picks the newest (or oldest, in the Bottom modes), reads it as text, and - unless you're in a Peek mode - deletes it. LIFO in, LIFO out, with a FIFO escape hatch and a no-delete escape hatch.
If the key folder is missing or holds no string files and fallback_enabled is off, the node throws and your generation stops. That's the sharp edge: because Normal mode deletes after reading, a run that pops then errors downstream has permanently consumed that value. The README warns about exactly this - pops that happened before an exception stay popped.
Install and gotchas
Same as the rest of the pack, and painless:
cd ComfyUI/custom_nodes
git clone https://github.com/concarne000/ComfyUI-Stacker
then restart. Or search "ComfyUI-Stacker" in ComfyUI Manager. No models, no real dependencies.
Two things trip people up:
- The stack is one-shot by default. Reading a value consumes it. For values you want around every run, use
Peekmode or push fresh each time. - Empty stacks crash on default settings. For a first run, either push first or turn on
fallback_enabledwith a sensible default string. You'll hit this once and then remember.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| key | STRING | default | — |
| fallback_enabled | BOOLEAN | false | — |
| override_enabled | BOOLEAN | false | — |
| stackmode | COMBO | Normal | 4 options: Normal, Peek, Pop Bottom, Peek Bottom |
| stackpathopt | STRING | ./ComfyUI/Stack/ | — |
| fallback_itemopt | STRING | — | |
| override_itemopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |