ComfyUI Node

Prompt Iterator

Queue every prompt on your list without touching the Queue button

By BizaNator·Created 11 months ago·Updated 11 months ago· 5
Prompt Iterator
    • prompt
    • filename
    • current_index
    • total_count
    • status
    promptsprompt 1 prompt 2 prompt 3
    modesequential
    base_filenameoutput
    filenames
    manual_index0
    resetfalse
    workflow_iddefault

    You've got a list of prompts - a character seen from four angles, a product in six backdrops, twenty color variants - and you want one render per prompt without babysitting the UI. This node is the answer to exactly that. It holds your list, hands the graph one prompt per queue press, and makes sure the saved files don't all collide as output_00001.png. It's the "queue it and walk away" node, and it's the one people search for when they ask "how do I generate a hundred images overnight?"

    What it actually does

    Paste your prompts in, one per line, and it cycles through them on each execution. The mechanism is worth knowing because it explains the weird stuff: the node keeps its position in a module-level state dictionary keyed by workflow_id. In sequential mode its IS_CHANGED() method returns NaN, which tells ComfyUI "this node changed, always re-run me" - so every time you hit Queue it moves to the next prompt instead of serving you a cached result. Without that trick, ComfyUI would happily run the same prompt forever.

    That state is in memory only. It persists across queue runs for the life of the ComfyUI session, and restarts when you restart ComfyUI. That's the design (the README calls it "remembers position between queue runs"), but it's the #1 source of confusion - people expect the cursor to reset when the workflow loads, and it doesn't.

    The inputs that matter

    • prompts - the whole point. One per line, blank lines skipped.
    • mode - sequential (advance each queue), manual (jump to manual_index), or single (always the first prompt).
    • base_filename - the prefix used when you're not supplying your own filenames.
    • filenames (optional) - one per line; when a matching line exists it overrides base_filename.
    • reset - flip to true and the cursor jumps back to prompt 1.
    • workflow_id - the state key. Keep it stable.

    What you wire it into

    prompt    → CLIPTextEncode text
    filename  → SaveImage filename_prefix
    

    Then just hit Queue as many times as you have prompts. The current_index, total_count, and status outputs are mostly informational - drop status into a text preview node and you can watch "Prompt 3/4 (Iteration 2)" tick by without squinting at the graph.

    Install

    ComfyUI Manager is the easy route: search "ComfyUI Prompt Iterator Extension" and click install. Or the manual way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/BizaNator/ComfyUI_PromptIterator
    

    Restart ComfyUI and the three nodes appear under utils/prompt. There's no requirements.txt, no model download, no Python deps beyond the standard library - it's a single self-contained Python file. This is the rare custom node that installs cleanly and can't break your environment, which is more than most of the ecosystem can claim. One wrinkle: the README's own clone command still points at the old BiloxiStudios/ org while the repo now lives at BizaNator/ - GitHub usually redirects, but Manager resolves the right one for you.

    Where people get burned

    • State resets on restart and there's no way to save it to disk. Long unattended runs are fine; restarts put you back at prompt 1.
    • Don't change workflow_id mid-run. You silently start a second cursor and your batch scrambles.
    • single mode always returns the first prompt. It's "always use prompt 1," nothing clever.
    • There's no seed output here. A plain KSampler rolls a new seed every run, so if you batch the same prompts twice you can't tell whether the difference is the prompt or the noise. That's the one thing that pushes people up to the Advanced node.
    • Empty prompts box hits an error path that returns fewer values than the node declares - just always leave at least one non-blank line.

    The same job can be done with wildcard nodes or a hand-rolled API script, but for a plain list through one graph, this is the zero-dependency middle ground. Keep it simple and it's honestly the least fiddly of the three iterator nodes.

    Categoryutils/prompt

    Inputs (7)

    NameTypeDefaultDescription
    promptsSTRINGprompt 1 prompt 2 prompt 3
    modeCOMBOsequential3 options: sequential, manual, single
    base_filenameSTRINGoutput
    filenamesoptSTRING
    manual_indexoptINT00–9999
    resetoptBOOLEANfalse
    workflow_idoptSTRINGdefault

    Outputs (5)

    NameTypeDescription
    promptSTRING
    filenameSTRING
    current_indexINT
    total_countINT
    statusSTRING