Nodes/comfy-ovum/Cast Any To List
ComfyUI Node

Cast Any To List

Tell ComfyUI 'this is a list now' and stop fighting the type system

By sfinktah·Created about a year ago·Updated 10 months ago· 7
Cast Any To List
  • py_list
  • LIST

ComfyUI's type system is a blessing and a curse. It keeps you from plugging a latent into a prompt slot, but it also means a value that's actually a list can refuse to connect to a socket that expects a list-shaped thing, just because the upstream node typed it as generic *. Cast Any To List is the adapter that fixes that: take any value, validate it's list-shaped, and expose it with a proper LIST type so downstream list consumers accept it.

It's the forward half of the pair - CastListToAny in the same pack does the reverse (a LIST pretending to be a generic *). Together they're the "stop fighting the graph engine" tools you reach for when a node from pack A won't connect to a node from pack B even though the data is obviously compatible.

How it behaves

The input is py_list (*) and the output is LIST. The node is tolerant about what "list" means:

  • An actual Python list → passed through unchanged.
  • A string → wrapped into a single-item list (["string"]).
  • Anything else iterable → converted to a list.

So it doesn't just declare the type - it nudges scalars into list shape too, which makes it useful when you have a value that should be treated as a one-element list but isn't yet.

When you'd reach for it

  • A node outputs * but you're feeding a node that wants a LIST.
  • You want to wrap a single prompt/seed/path into a one-item list so a batch node treats it as a collection.
  • You're bridging data between packs whose LIST typing conventions don't line up.

Installing it

It's part of comfy-ovum:

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

Restart, or ComfyUI Manager → search "comfy-ovum". No models, no extra dependencies.

The honest note

A "cast" here doesn't change the data - it changes how ComfyUI's graph builder types it. The output is still the same list object. If the underlying data isn't list-shaped and isn't coercible, you'll get an error downstream when a node tries to treat it as a list, because no cast can fix "this is genuinely not a collection." Keep that in mind when you're debugging a mysterious downstream failure: the cast node is not a proof, it's a label.

Categoryovum/data

Inputs (1)

NameTypeDefaultDescription
py_list*

Outputs (1)

NameTypeDescription
LISTLIST