Nodes/AK Pack/AK Index Multiple
ComfyUI Node

AK Index Multiple

Pull a slice out of a list and fan it out to separate wires

By akawana·Created 11 months ago·Updated 8 days ago· 2
AK Index Multiple
  • input_any
  • if_none
  • item_0
  • item_1
  • item_2
  • item_3
  • item_4
  • item_5
  • item_6
  • item_7
  • item_8
  • item_9
  • item_10
  • item_11
  • item_12
  • item_13
  • item_14
  • item_15
  • item_16
  • item_17
  • item_18
  • item_19
  • item_20
  • item_21
  • item_22
  • item_23
  • item_24
  • item_25
  • item_26
  • item_27
  • item_28
  • item_29
  • item_30
  • item_31
  • item_32
  • item_33
  • item_34
  • item_35
  • item_36
  • item_37
  • item_38
  • item_39
  • item_40
  • item_41
  • item_42
  • item_43
  • item_44
  • item_45
  • item_46
  • item_47
  • item_48
  • item_49
◄starting_index0►
◄length1►

Batch nodes give you lists; samplers want single items. AKIndexMultiple is the bridge. Feed it any list - images, masks, latents, prompts, whatever - and it hands you the items you asked for as individual outputs, each on its own wire. It's the de-spaghetti tool for workflows where you batch-load a folder of reference images and then want to do something different with each one.

The idea is the same as the sibling AKCLIPEncodeMultiple node, except that one CLIP-encodes its slice for you. If your list is prompt strings you want turned into conditioning, use that; if it's anything else - or you want the raw values - use this.

How it works

At its heart it's a range extraction. You give it:

  • input_any - the list. Images, latents, masks, text, numbers, whatever; the node is typed *.
  • starting_index - where in the list to start slicing (0 = first item).
  • length - how many items to pull out, up to 50.
  • if_none (optional) - a fallback value for slots that come up empty.

Then it fills its outputs item_0 through item_49. Here's the thing that trips people up: the node always exposes 50 outputs, but only length of them carry real data. You wire up as many as you asked for and ignore the rest. Set starting_index=0, length=4 and you'll use item_0–item_3; the remaining 46 outputs sit there unconnected and unused.

Anything outside the slice - either past the end of your list or beyond length - gets the if_none fallback if you provided one, or None if you didn't. That's deliberate: it means a short list won't make the node error out, it just yields empty slots you can catch downstream.

One implementation detail worth knowing: the node runs in list-input mode (INPUT_IS_LIST), so ComfyUI passes it the whole collection at once rather than item-by-item. That's what makes it fast on big batches.

When you'd actually use it

  • Load a folder of character refs with a batch image loader, slice out the first three, and send each to its own ControlNet or IPAdapter branch.
  • Take a list of prompts from a text-list builder and split off the first few to test individually.
  • Slice a batch of latents from a batch sampler when you only want to keep processing a subset.

Install

Part of AK Pack, so the standard drill applies. In ComfyUI Manager, search "AK Pack" and install; or clone it:

cd ComfyUI/custom_nodes
git clone https://github.com/akawana/ComfyUI-AK-Pack

Restart ComfyUI. No dependencies, no models - it's a pure-Python list utility.

Gotchas

  • Don't wire all 50 outputs. You'll just be feeding None into half your graph and wondering why things break. Wire what you set length to.
  • length caps at 50. If you genuinely need more items out, chain a second node or reconsider the workflow - 50 parallel branches is already a lot.
  • Watch the index math. starting_index is offset into the list for item_0. Off-by-one here is the single most common mistake, and the node won't complain - it'll just hand you the wrong image.
  • If a target expects a list further downstream and you've sliced it down to scalars, that's the expected trade-off - use a list-join or re-batch node to go back up.
CategoryAK/utils

Inputs (4)

NameTypeDefaultDescription
input_any*—
starting_indexINT0—
lengthINT11–50—
if_noneopt*—

Outputs (50)

NameTypeDescription
item_0*—
item_1*—
item_2*—
item_3*—
item_4*—
item_5*—
item_6*—
item_7*—
item_8*—
item_9*—
item_10*—
item_11*—
item_12*—
item_13*—
item_14*—
item_15*—
item_16*—
item_17*—
item_18*—
item_19*—
item_20*—
item_21*—
item_22*—
item_23*—
item_24*—
item_25*—
item_26*—
item_27*—
item_28*—
item_29*—
item_30*—
item_31*—
item_32*—
item_33*—
item_34*—
item_35*—
item_36*—
item_37*—
item_38*—
item_39*—
item_40*—
item_41*—
item_42*—
item_43*—
item_44*—
item_45*—
item_46*—
item_47*—
item_48*—
item_49*—