Nodes/comfy-ovum/Index Of
ComfyUI Node

Index Of

Find a value's spot in a list — but reach for the Ovum version instead

By sfinktah·Created about a year ago·Updated 10 months ago· 7
Index Of
  • py_list
  • search_element
  • INT
start

If you've ever needed to know where in a list a value lives - "is cat in this list, and at which position?" - that's this node's whole job. It's a JavaScript indexOf port for ComfyUI: give it a list and a value to hunt for, and it hands back the first matching index, or -1 when nothing matches.

Here's the catch worth knowing before you use it: this exact node is marked deprecated in the pack source. The display name in some menus shows up as "Index Of", but the class carries DEPRECATED = True and is named IndexOfDEPRECATED(batch) internally. sfinktah refactored this family and shipped newer variants - IndexOfBatchOvum (comfy batch flavor) and IndexOfOvum (Python-list flavor) - so if you're building a fresh workflow, pick one of those. This page still exists because old workflows reference the old class, so knowing it works (it does) keeps you from panicking when a downloaded graph wants it.

What it does, mechanically

Feed it a Python list on py_list, a search_element to look for, and it scans left to right using Python equality (==), returning the first hit's index. The three inputs, all from the schema:

  • py_list - the list to search. It has to actually be a Python list; anything else raises ValueError: Input must be a Python list.
  • search_element - any value. This is a lazy * (any) input, so you can wire in a string from a text node, an int from a counter, whatever.
  • start - where to begin looking. This one is a STRING, not an int, which is the fiddly part. Blank/whitespace means 0. A negative number counts back from the end and gets clamped into range. If you type garbage, it's treated as 0.

The output is a single INT. Wire it into a "Get By Index" style node, a switch, or a Compare node to branch on whether something was found (>= 0 means yes).

Where you actually use it

The classic pattern is list-driven iteration: you've got a batch of filenames or seeds, you want to confirm a particular entry exists and then grab it or index into a parallel list. Pair it with the pack's IfElseOvum or CompareOvum to gate a branch - "if this prompt tag is present at index >= 0, use the detailed sampler; otherwise skip." It's also handy for sanity checks in debugging: print the result to the console to confirm your list is what you think it is.

One behavioral note shared by all the pack's NewPointer list nodes: they force IS_CHANGED to always return NaN, meaning they never cache and re-run every execution. That's actually a plus for loop-heavy graphs - you won't get stale indices - but it's worth knowing if you're hunting for why a workflow is slower than you'd like.

Install and gotchas

Install the whole pack once: ComfyUI Manager → search comfy-ovum, or:

cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum

then restart ComfyUI. No model files, no API keys - this is pure utility code. The pack's requirements.txt (requests, pillow, numpy, pymediainfo, aiohttp, and a few more) is auto-installed by Manager; none of it matters for this node.

Realistically the only way to trip this node up is feeding it a non-list, or expecting it to mutate the input (it doesn't). And again: prefer IndexOfOvum / IndexOfBatchOvum for new graphs - they're the same search minus the deprecated sticker.

Categoryovum/lists/any

Inputs (3)

NameTypeDefaultDescription
py_list*
search_element*
startSTRINGOptional fromIndex as integer string. Blank/whitespace -> 0. Negative -> n+start clamped.

Outputs (1)

NameTypeDescription
INTINT