Nodes/ComfyAngel/ComfyAngel_WhileLoopEndAdvanced
ComfyUI Node

ComfyAngel_WhileLoopEndAdvanced

The recursion engine behind ComfyAngel loops — you don't add this one

By ThepExcel·Created 8 months ago·Updated about a month ago· 14
ComfyAngel_WhileLoopEndAdvanced
  • flow
  • initial_value0
  • initial_value1
  • initial_value2
  • initial_value3
  • initial_value4
  • initial_value5
  • initial_value6
  • initial_value7
  • initial_value8
  • initial_value9
  • value0
  • value1
  • value2
  • value3
  • value4
  • value5
  • value6
  • value7
  • value8
  • value9
condition
next_index

If you searched for this node, there's a good chance you didn't mean to. ComfyAngel_WhileLoopEndAdvanced is not something you add from the menu - the pack registers it, but marks it DEPRECATED and hides it. It's the internal engine that powers ComfyAngel's Advanced loop. When you build a loop with Loop Start (Advanced) and Loop End (Advanced), the Loop End node spawns this thing mid-execution to drive the iteration. You'll run into it in two situations: in an error traceback, or in a captured/saved workflow JSON where it shows up as a node ID even though you never placed it.

So the honest answer to "how do I use this?" is: you don't, directly. You use Loop Start Advanced → [your per-item work] → Loop End Advanced, and this node does the dirty work invisibly. But knowing what it actually does demystifies both the loop and those scary error messages, so here's the mechanism.

How it works

The node is a classic ComfyUI graph-expansion loop controller. Every iteration, it gets told two things: condition - "should we run another pass?" - and next_index - "where should the next pass pick up?" If the condition is false, it's done and returns whatever has accumulated so far. If it's true, it uses ComfyUI's GraphBuilder to clone the whole loop body - every node between Loop Start and Loop End - with the index bumped and the loop-carried values re-fed, and hands the cloned subgraph back to the engine to execute. The engine runs it, the node checks the condition again, and it repeats until the condition flips. That's the same expansion technique the built-in loop demo nodes and several other packs use: no Auto Queue, one queue run, results collected at the end.

The inputs and outputs

  • flow - FLOW_CONTROL from a Loop Start (Advanced) node. This is how the node knows which loop it belongs to.
  • condition - BOOLEAN. True means "iterate again."
  • next_index - INT. The index to resume the loop at on the next pass.
  • initial_value0 through initial_value9 - optional, any type. The ten loop-carried slots: values that travel across iterations and accumulate.

Outputs are value0 through value9 - the final accumulated values when the loop terminates. In the Simple variant these slots are collapsed to two; here you get ten, which is the whole reason the Advanced loop exists.

What to actually do

Don't hand-wire this node. If you find it in a saved workflow, it belongs there as machinery - leave it. If an error message names it, the problem is almost certainly upstream in your loop logic (an empty items list, or a node inside the loop that doesn't accept the per-item data), not in this node. Build your loop from the two public nodes and let this one do its job.

Installing

ComfyAngel installs via ComfyUI Manager (search ComfyAngel) or:

cd ComfyUI/custom_nodes
git clone https://github.com/ThepExcel/ComfyAngel

Restart ComfyUI. Only dependency is Pillow. One note: the loop nodes require a modern ComfyUI with the comfy_execution module - the source raises a clear error if that's missing, so keep ComfyUI updated.

CategoryComfyAngel/Loop/Internal

Inputs (13)

NameTypeDefaultDescription
flowFLOW_CONTROL
conditionBOOLEAN
next_indexINT
initial_value0opt*
initial_value1opt*
initial_value2opt*
initial_value3opt*
initial_value4opt*
initial_value5opt*
initial_value6opt*
initial_value7opt*
initial_value8opt*
initial_value9opt*

Outputs (10)

NameTypeDescription
value0*
value1*
value2*
value3*
value4*
value5*
value6*
value7*
value8*
value9*