Indexed List Entry
Grab item N out of any list, of any type
- any_list
- Entry
What it's for
ComfyUI's list handling is all-or-nothing: a list output fans out and every downstream node runs once per element. Sometimes you don't want the whole sequence - you want element 3, right now, as a single value. That's this node.
The reason it's more useful than it sounds is its type. any_list is declared as a wildcard, so it accepts a list of strings, a list of images, a batch, a list of latents - anything - and gives you one entry back. It's the "pick one out of the pile" primitive for the plumbing layer.
How it works
The indexing itself is one line: any_list[index % len(any_list)]. Two consequences worth knowing.
It wraps around. Ask for index 7 in a 3-item list and you get item 1 - no out-of-range error, no empty output. That's the documented behavior ("with wrap-around"), and it's genuinely handy for loops, but it also means a bug where your index is too big looks like a bug where your index is fine.
It works on anything with a length. This is the fun part: an IMAGE tensor in ComfyUI is shaped [batch, height, width, channels], so len() is the batch size and indexing it returns a single image. Wire a 6-image batch in, set index to 4, and you get that one image out as a normal single-image socket. Same trick works on a STRING list to get one name as a plain string. (On a bare string it indexes characters, which is almost never what you want - don't do that.)
The wildcard socket is implemented with an always-equal proxy type, the same hack rgthree popularized, so ComfyUI will happily let you connect it to anything regardless of type. Nothing validates your wiring; if you feed it the wrong thing, the failure lands in the consumer, not here.
Inputs and outputs
index is an INT widget (min 0, no practical maximum) and any_list is the wildcard input. One output, Entry, also typed as a wildcard, so it takes on whatever the receiving socket wants.
Because index is a normal widget, you can right-click it and Convert widget to input to drive it from a counter, a seed node, or the pack's own Incrementer - that's how you walk a list one item per queue. The node declares itself as always-changed (float("NaN") as the cache key) precisely so a runtime-generated index isn't served from a stale cache; the cost is that everything downstream of it re-executes every queue.
Installing it
Part of ComfyUI-TinyBee, category 🐝TinyBee/Lists. Standard library only, no models, no build step.
cd ComfyUI/custom_nodes
git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
Or search ComfyUI-TinyBee in ComfyUI Manager. The source notes these List/Dict nodes came over from the author's earlier ComfyUI-Nid pack under the same node names, so don't keep both packs installed - you'd get duplicate entries in the Add Node menu.
Where people get burned
Empty list, None output, and then a NoneType error in a node you thought was unrelated a few hops later. There's no error message at the source of the problem.
The index widget won't go below zero, so you don't get Python's negative-index-from-the-end behavior in the UI - index 0 is the first item, and the last item is count - 1.
And since the input is a wildcard, the node's output is a wildcard: ComfyUI won't stop you wiring an entry from a string list into an IMAGE socket. When a wildcard node misbehaves, the honest first move is to check what type is actually flowing through it rather than what you assumed.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| index | INT | 00–18446744073709550000 | — |
| any_list | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Entry | * | — |