ComfyUI Node

get item

Get item — reach into a list and pull out exactly one thing

By StableLlama·Created about a year ago·Updated 4 days ago· 48
get item
  • list
  • item
index0

get item is the node that reaches into a LIST and pulls out one element by position. first and last cover the ends, but if you need "the third item," "the item at index 7," or - the killer feature - "the second-to-last item," this is the one. Every list-access workflow eventually funnels through it.

How it works

It's Python's list indexing, wrapped so it can't crash your graph:

try:
    return (list[index],)
except IndexError:
    return (None,)

Two things to know about the index input. First, negative indices count from the end - -1 is the last element, -2 the second-to-last - same as Python. Second, an out-of-range index returns None instead of throwing. list[99] on a three-item list gives you None, not a graph-breaking error. That's forgiving, but it means a wrong index can silently hand None to the next node. If you're debugging "why is my value None?", the index being off-by-one is the first suspect.

The output is a single item of whatever type the element is (* in the schema).

Where you'd use it

  • Positional access. "Use the first three seeds," "take the midpoint value of a sweep."
  • Negative indexing. Grab the last item of a list without knowing its length - that's the -1 trick in action.
  • Feeding single values to typed nodes. Pull an int out of a list and hand it to a sampler or comparison node that wants one value, not a list.

Installing

It's in the "Basic data handling" pack by StableLlama. ComfyUI Manager: search "Basic data handling", install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling

Restart ComfyUI. Zero dependencies, no models - pure Python, one of the cleanest installs in the ecosystem.

Gotchas worth knowing

  • Out-of-range → None, silently. Count your list before you index it (length is right there in the same pack).
  • Negative indices work from the end; there's no separate "from end" mode to enable.
  • It operates on the pack's LIST type, not a native data list. Same distinction as everywhere else in this pack.
CategoryBasic/LIST

Inputs (2)

NameTypeDefaultDescription
listLIST
indexINT0

Outputs (1)

NameTypeDescription
item*