Worklist To Item List (Inspire)
Turn a ComfyUI list into a Foreach loop
- item
- item_list
ComfyUI has two different ideas of "do this for each item," and this node is the bridge between them. The built-in idea is the list: when a node outputs a list, ComfyUI re-runs the downstream graph once per element. It works, but it's implicit and awkward to control. Inspire adds an explicit alternative - a real Foreach loop (ForeachList begin/end nodes) - that behaves more like a for-loop you'd actually write. Worklist To Item List is how you get from the first world into the second.
You feed it a normal ComfyUI list, and it collects all those repetitions into a single ITEM_LIST object. That ITEM_LIST is the thing the Foreach nodes iterate over. So the pattern is: build or load a list the usual way, run it through this node to package it, then drive a ForeachList loop with the result.
Why bother with Foreach at all
The native list mechanism spreads execution across the whole graph implicitly, which gets hard to reason about when you want to accumulate something across iterations or run a defined block of nodes per item. The Foreach loop makes the iteration explicit and gives you a clean begin/end structure with an intermediate value you can carry forward. This node is the required first step to use it - the README's own description is blunt: it "groups these repetitions (a.k.a. list) into a single ITEM_LIST output. ITEM_LIST can then be used in ForeachList."
The inputs and outputs that matter
Dead simple - one of each:
item(type*) - the list you want to iterate. It's a wildcard, so it takes any type: images, latents, strings, numbers. The key is that it's fed as a list, because the node's job is to gather each repeated item into the collection.
The single output is item_list (type ITEM_LIST) - hand this to the ▶Foreach List (Inspire) begin node to start looping.
How to install it
ComfyUI Manager: search ComfyUI Inspire Pack, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Inspire-Pack
then restart. It's a Dr.Lt.Data pack (ComfyUI-Manager, Impact Pack).
Common issues & troubleshooting
The ITEM_LIST only has one item. This node collects across list execution - if item isn't actually a list (it's a single value), there's nothing to gather and you get a one-element list. Make sure the upstream node genuinely produces a list (loaders like Load Image List From Dir do; a single image doesn't).
Foreach loop errors or runs zero times. Check the wiring on the Foreach nodes themselves, not this one. Per the README, ForeachListEnd needs flow_control and remained_list connected directly from the begin node's outputs - that's the most common mistake. This node just supplies the ITEM_LIST; the loop plumbing is separate.
Type errors downstream. ITEM_LIST is a specific Inspire type. It only fits the Foreach nodes - you can't feed it into something expecting a plain list or an image. If you don't actually need the explicit loop, you may not need this node at all; the native list execution might do the job on its own.
Nested loops behaving strangely. The Foreach system is powerful but stateful; nesting it or combining it with native list execution in the same graph can get confusing fast. Keep one iteration model per section of the graph and it stays predictable.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| item | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| item_list | ITEM_LIST | — |