ComfyUI Node

Ino Length

How many items are in that list? One clean number, no guesswork

By nobandegani·Created about a year ago·Updated 2 months ago· 6
Ino Length
  • input
  • length

ComfyUI is full of "list" outputs these days - a batch of images, a list of prompts, a pile of conditioning - and half the time what you need to know about one is simply how many things are in it. Ino Length is that question turned into a node. Wire any list or tuple in, and it hands you the count as an integer you can feed into a switch, a loop counter, a progress check, or a node that needs to know batch size before it does anything.

It ships in ComfyUI Ino Nodes (nobandegani/ComfyUI-InoNodes), a V3-schema pack of 125+ utility nodes. Ino Length lives in the pack's "extra" category, alongside its relay, switches, and log tools - the glue nodes that don't generate anything but make workflows behave.

How it works

This one is about as deep as a ruler. The node takes a single input of any type, measures it with Python's len(), and returns that as the length output. The important detail is what happens when the input isn't a list or tuple: it returns -1 instead of crashing. That's a deliberate sentinel - a negative number that can't be a real list size, so your downstream logic can detect "wrong input type" without ComfyUI throwing a fit and killing the run.

The input is wired as a match-type, so it'll accept whatever you throw at it. There's no configuration, no options, nothing to mis-set. One input, one output. This is a node that's boring on purpose.

When you'd actually use it

The classic spots:

  • Batch sanity checks. Before you feed a list of images into something that expects a specific batch size, confirm the count.
  • Loop control. Combine it with the pack's Ino Switch On Int to route differently based on how many items arrived.
  • Debugging. Someone else's workflow hands you a mysterious list; a quick Ino Length tells you whether it's empty or has 47 entries, which instantly rules out half your theories.

The gotcha worth knowing

Because the output is a plain integer, you can also wire a scalar (like a number from a math node) into input - and you'll get -1 right back. That's the sentinel doing its job, but it surprises people the first time. If your downstream node is doing arithmetic on the result, check for -1 first, or just make sure you're feeding it actual lists.

Installing it

ComfyUI Ino Nodes is a one-pack install:

  • ComfyUI Manager (easiest): search for "ComfyUI Ino Nodes", install, restart.
  • Manual:
    cd ComfyUI/custom_nodes
    git clone https://github.com/nobandegani/ComfyUI-InoNodes.git
    cd ComfyUI-InoNodes
    pip install -r requirements.txt
    Then restart ComfyUI.

Note the pack requires inopyutils and expects a reasonably current ComfyUI (it's all V3 schema). It's a small, niche pack with little community footprint, so don't expect to find many workflows using it - but for a five-second "how big is this list" answer, Ino Length is hard to beat.

CategoryInoExtraNodes

Inputs (1)

NameTypeDefaultDescription
inputCOMFY_MATCHTYPE_V3

Outputs (1)

NameTypeDescription
lengthINT