ComfyUI Node

Iterator List

The node that picks which generation you're on

By franciscotorrado·Created 7 months ago·Updated 7 months ago· 0
Iterator List
  • item1
  • item2
  • item3
  • item4
  • item5
  • item6
  • trigger
  • IMAGE
  • AUDIO_TEXT
  • VIDEO_PROMPT
  • IS_FINISHED
iterator_iddefault_iterator
resetfalse

If you've ever wanted to batch-generate a sequence - ten images, each with its own prompt, or a video per scene - you've hit ComfyUI's wall: there's no loop primitive, and wiring a graph back into itself throws circular dependency errors. Iterator List is the controller of ComfyUI-Automation's stateful iterator system. You stack your items, and it hands the graph whichever one is "active" right now, based on an index stored outside the graph. It's not fancy. It's exactly the missing piece.

How it works

The List reads an index from a global state dictionary, keyed by your iterator_id. Every time the graph executes, it returns the image, audio text, and video prompt of the item at that index. The companion Iterator Signal node increments the index and re-queues the workflow; the List's IS_CHANGED method returns the current index value, which tells ComfyUI "my output changed, re-run me" - so the downstream graph re-executes with the next item automatically.

One detail worth knowing: if the stored index runs past the end of your list (say you deleted an item mid-run), it clamps to the last item and sets IS_FINISHED true. It deliberately does not auto-reset to zero, or you'd loop forever. Reset is your call.

The inputs and outputs that matter

  • iterator_id - the string that syncs this List with your Iterator Signal. Default default_iterator. Same string on both, or nothing advances.
  • reset - a boolean that forces the index back to 0. Turn it on once to restart the batch.
  • item1 through item6 - your ITERATOR_ITEM bundles, produced by Iterator Item nodes. Six slots, no more.
  • trigger - an any-type dummy input. Connect literally anything here to force this node to execute after whatever you wired in, which matters for manual execution ordering in big graphs.
  • Outputs: IMAGE, AUDIO_TEXT, and VIDEO_PROMPT from the currently active item, plus IS_FINISHED - true when you've hit the last item. That boolean is what you feed into the Signal to stop the loop.

Installing it

Same install for all nodes in this pack:

cd ComfyUI/custom_nodes
git clone https://github.com/franciscotorrado/ComfyUI-Automation
pip install -r requirements.txt

Restart ComfyUI after that. Or use ComfyUI Manager and search "ComfyUI-Automation". No model files, just the one ffmpeg-python dependency. Beware the README's copy-paste block - it still shows a placeholder repo URL, so use the link above.

Common issues

Six items is the hard ceiling. Need more? Options: give a second List its own iterator_id and chain it, or keep it simple and build a couple of batches. Nobody enjoys a ten-item List anyway.

The IS_FINISHED output is easy to ignore, and then your loop runs forever - the Signal won't stop on its own unless you wire it in. And if you're testing and the List keeps showing the first item no matter what, double-check your iterator_id matches the Signal exactly. Case, spacing, everything. That mismatch is the single most common way this pack "doesn't work," and it's never the node's fault.

One more: because all the iterator nodes share one state namespace, don't reuse an iterator_id across two different Lists in the same workflow - they'll stomp on each other's indexes and you'll get items in the wrong order.

CategoryIterator

Inputs (9)

NameTypeDefaultDescription
iterator_idSTRINGdefault_iterator
resetBOOLEANfalse
item1optITERATOR_ITEM
item2optITERATOR_ITEM
item3optITERATOR_ITEM
item4optITERATOR_ITEM
item5optITERATOR_ITEM
item6optITERATOR_ITEM
triggeropt*

Outputs (4)

NameTypeDescription
IMAGEIMAGE
AUDIO_TEXTSTRING
VIDEO_PROMPTSTRING
IS_FINISHEDBOOLEAN