Select from Any List (Badman)
Grab one item out of a list by index
- item
ComfyUI loves handing you lists - a batch of captions from a BLIP interrogator, a directory of images loaded as a list, a stack of prompts expanded from a wildcard file. Sometimes you don't want the whole list, you want one specific item out of it. That's the entire job of this node: give it a list and an index, get back the item at that position.
How it works
There's no processing here, just indexing. The pack's own README describes it as "a generic version of the string selector that works on any list type, returning the item at the requested index" - it's the same idea as the pack's dedicated Select String from List node, but not locked to strings. Feed it a list of images, a list of prompts, whatever your upstream node produces as a list, and it hands back the single entry at index.
The one genuinely nice touch: negative indices work, the way they do in Python. -1 always means "the last item," regardless of how long the list is - useful if you just want the final frame, the last generated variant, or the tail end of a wildcard-expanded prompt list without knowing exactly how many items are in it.
The inputs and outputs that matter
any_list- the list to select from. The node's own tooltip is just that: "List to select from." It's built to be type-agnostic, so ComfyUI won't stop you at graph-build time if you wire in something unexpected - you'll only find out at runtime if the type doesn't make sense downstream.index- which position to grab, from -10,000 to 10,000. Positive counts from the front (0 is the first item), negative counts from the back (-1 is the last).
Output: item, the single value at that index. Wire it wherever a single value of that type would normally go - a prompt string into a CLIP Text Encode, an image into a preview, whatever your list actually contains.
How to install it
Search ComfyUI-BadmanNodes in ComfyUI Manager, or clone it manually:
cd ComfyUI/custom_nodes
git clone https://github.com/MariusKM/ComfyUI-BadmanNodes
Restart ComfyUI afterward. It's a lightweight personal utility pack - no model downloads, no extra Python dependencies for this node. It's obscure enough that it doesn't show up in community write-ups; there's no track record to lean on here beyond the author's own description, so judge it on what it does rather than any reputation.
Common issues & troubleshooting
Index out of range. Unlike the pack's Prompt File Image Loader, this node has no wrap-around option. Ask for an index beyond the length of your list and you'll get an error rather than a silent wrap. If your list length varies run to run (a wildcard expansion, a variable-size batch), pin down the length first or use a small negative index like -1 that stays valid no matter how the list grows or shrinks.
Wrong type downstream. Because any_list is type-agnostic, ComfyUI can't catch a mismatch when you build the graph - plugging a list of images into a slot expecting a string, say, will only surface as a runtime error when the workflow actually runs. If a run fails at this node with a confusing type error, check what's actually flowing into any_list before you assume the node itself is broken.
You wanted the string-specific selector. This is the generic version. If your use case really is just picking a caption out of a string list, the pack also ships Select String from List (Badman), a separate node built for that one case - worth knowing they're not the same node under two names.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| any_list | INT | List to select from | |
| index | INT | 0-10000–10000 | Index to select (supports negative indices) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| item | INT | — |