ComfyUI Node

ListWrapper

Pack anything into a list ComfyUI can pass around

By lldacing·Created 3 years ago·Updated 8 months ago· 96
ListWrapper
  • any_1
  • any_2
  • *

This is the exact opposite move from its sibling node, ListUnWrapper. Where that one explodes a list into N separate graph runs, ListWrapper takes one or two loose values - of any type, and they don't have to match each other - and bundles them into a single list. The pack's own shorthand for it is worth sitting with: [a,b] in and [c] in become [[a,b],[c]] out. It wraps what you give it as one more list, it doesn't flatten anything.

How it works

ComfyUI's graph normally treats each wire as carrying one value. ListWrapper's whole job is constructing an actual Python list object out of whatever's connected to its inputs and putting that list, as a single unit, on its output wire. That's the key distinction from ListUnWrapper: this node's output is not marked as a list-output, so it doesn't trigger multiple downstream runs - it's a normal single wire that happens to carry a list-shaped value.

The inputs and outputs that matter

  • any_1 (required) - the first value, any type.
  • any_2 (optional) - the second, also any type. Leave it disconnected and you get a one-item list back.
  • One output, untyped, carrying the list you just built.

Where you'd actually use it

Mostly as the setup half of the size-preview trick described on ListUnWrapper's page: generate two images at different resolutions, wrap them together here, then run the result through ListUnWrapper right before PreviewImage so each one previews on its own instead of ComfyUI trying to force them into one batch tensor.

It's also the fix any time a downstream node wants a proper LIST-typed input (this pack's SliceList or IndexOfList, for example) but what you actually have on hand are two or three loose values sitting on separate wires rather than something already list-shaped.

How to install it

Via ComfyUI Manager: search comfyui-easyapi-nodes, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/lldacing/comfyui-easyapi-nodes.git
cd comfyui-easyapi-nodes
pip install -r requirements.txt

Restart ComfyUI; git pull in that folder to upgrade later. No models, no heavy dependencies.

Common issues & troubleshooting

Because both inputs accept literally anything, ComfyUI won't stop you from wrapping, say, an IMAGE and a STRING into the same list. That's a feature right up until whatever reads the list back out assumes every element is the same type and errors two nodes downstream instead of here. Keep element types consistent unless the consumer is explicitly built for mixed lists - this pack's own ConvertTypeToAny exists specifically for bridging type mismatches like that.

The other easy mix-up is confusing this node's output with ListUnWrapper's. ListWrapper's output is a single wire; if you're expecting the rest of the graph to run once per item right after this node, it won't - that's what ListUnWrapper is for, and the two are meant to be used as a pair, not interchangeably.

CategoryEasyApi/List

Inputs (2)

NameTypeDefaultDescription
any_1*
any_2opt*

Outputs (1)

NameTypeDescription
**