RapidStringIterator
Queue a List, Get One Line Per Run — Until It Stops You
- current_string
- current_index
- is_last
RapidStringIterator is how this pack batches through a list of prompts without any scripting. You paste a newline-separated list into the node, queue the workflow repeatedly, and each run returns the next line along with its index. When you've gone through the whole list, it throws an error on purpose to tell you the batch is done.
That last part is the design philosophy in a nutshell. A lot of iterator nodes wrap around - when you hit the end, they loop back to the start. This one refuses. It's the "nowrap" variant (the author's default node_id is literally iterator_nowrap): once every line has been served, the next execution raises StopIteration with a message that says to set reset=True if you want to restart. In the rapidfire workflow, a hard stop is a feature - it prevents you from silently looping a batch you thought was finished.
How it works
The node keeps its state in a class-level dictionary keyed by the node_id string, so state persists across queue runs (which is exactly what you want from an iterator) but is shared between any two nodes with the same node_id. Each execution splits string_list on newlines, serves the current line, and advances. Outputs tell you everything you need mid-batch:
- current_string - the line for this run.
- current_index - its 0-based position in the list.
- is_last - true when you're on the final line, so downstream nodes can do something special (log it, save differently) before the stop hits.
What you set
- string_list - one item per line. This is your batch.
- reset - set true to restart from index 0 on the next run.
- node_id - the state key. The default works for a single iterator, but if your workflow has several, give each a unique
node_idor they'll share one counter and fight each other.
Install and common gotchas
Part of comfyui-rapidfire, no extra dependencies. Install via ComfyUI Manager (search "comfyui-rapidfire") or:
cd ComfyUI/custom_nodes
git clone https://github.com/Zeks/comfyui-rapidfire
then restart ComfyUI.
Two things trip people up. First, the "error" at the end of the list looks like a crash in the console - it's not, it's the intended end-of-batch signal, so don't go hunting for a bug. Second, the shared-state behavior: two iterator nodes both using the default node_id will advance together, which is rarely what you want. Change one of them. The full-prompt equivalent of batching prompts is the old A1111 wildcard trick, but where that picks randomly per run, this iterator is deterministic and ordered - which makes it the right tool when the order of your batch matters.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| string_list | STRING | — | |
| reset | BOOLEAN | false | — |
| node_id | STRING | iterator_nowrap | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| current_string | STRING | — |
| current_index | INT | — |
| is_last | BOOLEAN | — |