List Get Index
The tiny node that makes prompt lists usable
- list
- element
List Get Index is the second half of the Text Split pairing: it pulls a single element out of a STRING_LIST by index. Nothing more. But that one operation is what turns "a box full of prompts" into "the prompt for this run", which is why these two nodes show up together in so many small utility workflows.
How it works
The whole mechanism is Python list indexing: list[index], returned as a plain string. The detail that makes it worth having is negative indices - -1 gives you the last element, -2 the second-to-last, and so on. That's a genuinely handy trick when a workflow appends to a list and you always want "the most recent one" without knowing how long it is.
The inputs that matter
list- aSTRING_LIST. It doesn't care where the list came from; Text Split is the natural source in this pack, but any node that outputsSTRING_LISTworks, so it plays nicely with list helpers from other packs too.index- an integer, default0, with a widget range of −10000 to 10000. Negative values count from the end, per the tooltip.
One output, element, a plain STRING - exactly what a CLIP Text Encode prompt input wants.
The one thing that will bite you
There's no bounds check. Ask for index 10 on a five-element list and the node throws an IndexError, erroring the whole queue. The widget lets you dial in big numbers, so keep the index inside the length of whatever list you're reading - or use a negative index, which is naturally bounded from the end. This is the only real failure mode, and it's a self-inflicted one.
Typical pattern: Text Split → List Get Index → CLIP Text Encode, then vary the index per run - from a seed node, a counter, or just by hand - to batch through a list of prompts. Wire -1 in if you want to always grab the last line a workflow just appended.
Installing it
Part of jan-prompt-presets (https://github.com/kursopiko/jan-prompt-presets) by JAN (@kursopiko). Install via ComfyUI Manager (search jan-prompt-presets) and restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/kursopiko/jan-prompt-presets
Restart ComfyUI. No dependencies, nothing to download. It's under prompt/presets.
Troubleshooting
- Queue errors with an index message. You indexed past the end of the list. Count your elements, or use a negative index.
- Empty result. You asked for index
0on an empty list - same error family, make sure the list actually has lines. - Node not showing up. Pack not installed or no restart; check the
prompt/presetscategory.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| list | STRING_LIST | The list to read from. | |
| index | INT | 0-10000–10000 | Index of the element to retrieve. Negative values count from the end. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| element | STRING | — |