ComfyUI Node

List: Slice

Trim a ComfyUI List down to a subrange without touching the rest of the graph

By godmt·Created 2 years ago·Updated about a month ago· 16
List: Slice
  • ANY
  • *
start0
end0

Say you built a List of ten prompts, but you only want to test items three through six while you're iterating on the rest of the pipeline. Re-running all ten every time you tweak a sampler setting wastes GPU time. List: Slice cuts a ComfyUI List down to a subrange - Python start:end style - and hands the result back out as a List, so everything downstream keeps working exactly as before, just on fewer items.

This node turns up in the wild more than you'd guess for something with such a plain name - it's the kind of utility that ends up buried inside shared workflows people download from Civitai or Reddit, and it's common enough that "where do I get GODMT_ListSlice from" is a real question people ask when a workflow reports it as a missing node. The answer is always the same: it's in this pack, and ComfyUI Manager's "Install Missing Custom Nodes" will usually resolve it for you automatically.

How it works

You connect a List-processing value, set start and end, and get back a List containing only the items in that range. It's Python slice semantics exactly: the item at end is not included, same as my_list[start:end] in plain Python. That trips up anyone who expects end to be inclusive - set end to 5 expecting five items back and you'll actually get items 0 through 4.

The inputs and outputs that matter

  • ANY - the ComfyUI List to slice. Accepts any List-typed value regardless of what's inside it.
  • start - slice start index, Python-style (so negative values count from the end, same convention as the rest of the pack).
  • end - slice end boundary, exclusive. The item sitting at this index is left out of the result.

One output, typed * and still a List (is_list: true) - this is the important part. Unlike List: Get By Index, which collapses to a single value, Slice keeps you in List-processing mode. Downstream nodes still run once per remaining item, they just run on fewer of them.

How to install it

Search "ComfyUI-List-Utils" in ComfyUI Manager and install, or clone it directly:

cd ComfyUI/custom_nodes
git clone https://github.com/godmt/ComfyUI-List-Utils.git

Restart ComfyUI. No models, no extra dependencies - if you're only after this one node because a downloaded workflow flagged it as missing, cloning the whole repo is still the right move; the pack is small and this is a single-file install either way.

Common issues & troubleshooting

Got one fewer item than expected. This is almost always the exclusive-end behavior catching someone who thought in inclusive terms. If you want items 3 through 6 inclusive, end needs to be 7, not 6.

Slicing did nothing, or the whole graph still ran on every item. Double check you actually connected a ComfyUI List and not a PYLIST - this node is specifically for List-processing values. If you're working with a raw Python list instead, PyList: Slice (also in this pack) is the one you want; it takes and returns PYLIST values rather than triggering per-item execution.

A downloaded workflow reports this node as missing. That's normal - it's a small, niche utility pack, not something that ships by default. Open ComfyUI Manager, use "Install Missing Custom Nodes," and it'll pull the whole ComfyUI-List-Utils repo in automatically. If Manager can't resolve it for some reason, the manual git clone above does the same thing.

Categorylist_utils

Inputs (3)

NameTypeDefaultDescription
ANY*Connect the ComfyUI List-processing value to slice.
startINT0-9007199254740992–9007199254740992Slice start index, matching Python list[start:end].
endINT0-9007199254740992–9007199254740992Slice end index. The item at this index is not included.

Outputs (1)

NameTypeDescription
**The sliced ComfyUI List-processing output.