Get List Length
The safety check your list-handling workflows keep needing
- array
- length
Get List Length counts how many items are in a list and returns that number as an INT. That's the entire spec - len(my_list), exposed as a node - and it lives in the ovum/loop category of the comfy-ovum pack because knowing the size of things is half of making loops and conditionals behave.
It's the quiet enabler node. On its own it does nothing interesting; wired into the right place it prevents a class of annoying failures. Before you index into a list with GetByIndex, check the length so you don't step off the end. Before you loop over a list, confirm it isn't empty. Before you branch on "did this batch produce anything?", compare the length to zero. All of those are "ask the list how big it is" moments, and this is the node that answers.
Inputs and output
- array (
*) - the list to measure. The permissive type means it accepts any list-shaped value; the node expects a real Python list and raises a clear "Input 'array' for GetListLength must be a list" error if you hand it something else. - Output: length (
INT) - the item count.
It also logs the count to the console (GetListLength: 3), which sounds like noise until you're debugging a workflow that silently produces empty lists - then it's a free breadcrumb.
How it fits with the pack's logic family
This is the companion to isListNotEmpty (the same idea returning a BOOLEAN instead of a count) and to the loop nodes. A common pattern: GetListLength → compare against a target with CompareOvum → feed the boolean into IfElseOvum to decide whether to process the list or skip it. It's the measuring tape for the rest of Ovum's ovum/loop toolbox.
Installing it
It's part of sfinktah/comfy-ovum:
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
or search comfy-ovum in ComfyUI Manager, then restart. No models.
Gotchas
The only real one: it's strict about receiving an actual list. Tuples, dicts, and scalars will raise instead of quietly returning a wrong answer, which is honestly the right behavior - a wrong length is worse than an error you can see. And note the input is named array rather than py_list; don't let the naming make you think it's for numpy arrays specifically, it's for Python lists. Small, strict, and exactly as boring as a length check should be.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| array | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| length | INT | — |