Get List Item
Pull one thing out of a list (and it doesn't even need to be a list)
- input_list
- item
Lists are everywhere in ComfyUI the moment you stop generating one image at a time - prompt lists, tag lists, batches of images. And once you have a list, the most common thing you want is one specific item out of it. Get List Item does that, and it's more forgiving than most: it will happily accept a batch tensor, an iterable, or even a plain value, and hand you the item at whatever index you ask for.
It's part of DebugPadawan's ComfyUI Essentials, a small MIT-licensed utility pack with a whole family of list nodes. This one is the "index into it" member.
How it works
The input_list input is typed as a wildcard with force-input, and the node is defensive about what it receives:
- A torch tensor (like an image batch) gets converted via
.tolist(). - Any other iterable that isn't a string gets turned into a list.
- A plain value (even a string) gets wrapped into a single-item list, so the node never crashes on a bad input.
Then it returns input_list[index]. Two niceties beyond the basics:
- Negative indexes work.
-1grabs the last item, which is genuinely handy. - Out of range doesn't error. If
indexis past the end, it silently returns the last item; if it's negative-past-the-start, the first. Useful for robustness, mildly dangerous if you expected an error to tell you something's off.
Inputs and outputs that matter
- input_list - the list, batch, or iterable.
- index - the zero-based position, default 0, range −1,000,000 to +1,000,000.
One output: item, whatever type the list held - an image, a string, a number.
Install
Standard custom-node fare:
cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials.git
Restart ComfyUI, or install via ComfyUI Manager by searching "DebugPadawan". requirements.txt lists numpy, torch, and opencv-python - numpy and torch already ship with ComfyUI and the shipped code never imports cv2, so no heavy downloads, no model files, no API keys.
Where people get burned
- The silent fallback. Feed it an empty list and you get
None- no crash, no warning. Feed it an index past the end and you get the last item. If your workflow depends on that erroring, it won't. - Remember it's zero-based.
index = 1is the second item, not the first. The classic off-by-one. - Converting a tensor to a list can be big.
.tolist()on a 64-image batch produces a list of 64 numpy arrays in memory. Fine at that scale; don't route a giant batch through this in a loop expecting speed.
A typical use: slice a batch apart with the pack's List Slicer, then pull one item out by index for a detail pass while the rest of the batch flows elsewhere.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input_list | * | — | |
| index | INT | 0-1000000–1000000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| item | * | — |