Nodes/WebApp API/Combine lists
ComfyUI Node

Combine lists

Merge, Cartesian product, and friends

By MonkeyProof-Solutions-BV·Created 6 months ago·Updated 3 months ago· 2
Combine lists
  • list_1
  • list_2
  • list_3
  • list_4
  • list_5
  • list_1
  • list_2
  • list_3
  • list_4
  • list_5
method

Here's the one node in this pack that earns its keep even if you never build a web app. WebApp_Combinelists is a plain list utility: it takes up to five lists in, combines them one of six ways, and hands back up to five lists. It ships in the ComfyUI_webapp pack because that pack's whole design leans on ComfyUI's list processing - every web-app control outputs a list, and this node is how you reshape those lists into the batches you actually want to run.

Pick your poison with the method combo:

  • Merge - concatenate everything into one list.
  • Cartesian product - every combination of one item from each list. Feed it [a, b] and [1, 2], get [a, 1], [a, 2], [b, 1], [b, 2]. This is the killer feature for grid runs: prompts × seeds × CFG values all cross-multiplied.
  • Filter by last - keep items in every other list wherever the last list's value is truthy. A mask list drives what survives.
  • Shortest - trim every list to the length of the shortest one.
  • Expand - First / Last / Repeating - pad all lists up to the length of the longest, by repeating the first item, the last item, or cycling through the whole list.

What's in, what's out

Inputs are list_1 and list_2 (required) plus list_3 through list_5 (optional). Outputs are list_1 through list_5, one per input. The inputs are * (ANY type), so they'll swallow prompts, seeds, widths, whatever you throw at them.

One behavior to know up front, straight from the author's description: output slots with no value return [None]. Don't wire all five outputs expecting data - an output only carries something if the combination produced it. That's the thing that'll have you staring at a [None] wondering where your list went.

A concrete use

Say you're generating a variation grid from a web-app form. Two prompts, three seeds, two widths. Wire the prompts list and seeds list and widths list in, pick Cartesian product, and the output lists zip up so the downstream sampler runs 2 × 3 × 2 = 12 combinations. That's the entire appeal: one node turns separate control lists into aligned batches without hand-building a scheduler.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/MonkeyProof-Solutions-BV/ComfyUI_webapp

Restart ComfyUI, or grab it via ComfyUI Manager (search ComfyUI_webapp / "WebApp API"). No models, no downloads - dependencies are just pillow and torch, both already present in a standard install. One compatibility note: the pack is written against the newer backend node API (comfy_api.latest), so keep ComfyUI updated or none of these nodes will register.

Gotchas

Beyond the [None] behavior: Expand - First on an empty list will crash or misbehave, because there's no first item to repeat - don't feed it empties. And remember the type of the output is whatever you put in; there's no type checking on * sockets, so an int list into a string-expecting node will fail downstream, not here.

Categoryutils/list

Inputs (6)

NameTypeDefaultDescription
methodCOMBOList combination method
list_1*List input #1
list_2*List input #2
list_3opt*List input #3
list_4opt*List input #4
list_5opt*List input #5

Outputs (5)

NameTypeDescription
list_1*List output #1
list_2*List output #2
list_3*List output #3
list_4*List output #4
list_5*List output #5