Nodes/ComfyAngel/ComfyAngel_WhileLoopEndSimple
ComfyUI Node

ComfyAngel_WhileLoopEndSimple

ComfyAngel's hidden loop controller — the two-slot version

By ThepExcel·Created 8 months ago·Updated about a month ago· 14
ComfyAngel_WhileLoopEndSimple
  • flow
  • accumulated1
  • accumulated2
  • results1
  • results2
condition
next_index

ComfyAngel_WhileLoopEndSimple is the quieter half of the pair. Like its Advanced sibling, it's an internal node that ComfyAngel registers but hides from the menu (DEPRECATED flag, no display name). When you use the pack's public Loop Start and Loop End (Simple) nodes, the Loop End node constructs this controller on the fly to drive the iteration. You never place it by hand - you encounter it in saved workflow JSON or in error messages, and neither means you did anything wrong.

If you're here because a traceback mentioned it, the short version is: the loop machinery is fine, look at the loop body. But it helps to understand what this node actually is, because it demystifies how the pack's "true loop without Auto Queue" works at all.

How it works

Same pattern as the Advanced variant, with two accumulation slots instead of ten. Each iteration it checks condition: if false, iteration stops and it returns what's accumulated; if true, it clones the loop body - every node between Loop Start and Loop End - via ComfyUI's GraphBuilder, bumps the index to next_index, re-feeds the accumulated values, and hands the cloned subgraph back to the engine to run again. Round and round until the condition flips, then the collected results come out. It's graph expansion, the same technique ComfyUI's own loop demo nodes use: one queue run, no Auto Queue, results gathered at the end.

The inputs and outputs

  • flow - FLOW_CONTROL from a Loop Start (Simple) node. Identifies which loop this belongs to.
  • condition - BOOLEAN. Whether to run another iteration.
  • next_index - INT. Where the loop resumes on the next pass.
  • accumulated1 / accumulated2 - optional, any type. The two loop-carried slots; each accumulates a value across iterations.

Outputs are results1 and results2 - the accumulated results when the loop ends.

What to actually do

Treat this as infrastructure, not a tool. Build loops from the public Loop Start 🪽 and Loop End 🪽 nodes - Loop Start takes an items list or image batch, Loop End collects up to two result streams, and this controller does the invisible recursion. If a saved workflow contains it, that's normal and you leave it alone. If an error names it, the cause is upstream: an empty items list (the pack raises "Cannot loop over empty items"), or a node inside the loop choking on the per-item data.

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. The loop nodes need a recent ComfyUI with the comfy_execution module - the source checks for it and errors clearly if absent, so keep ComfyUI updated rather than blaming this node.

CategoryComfyAngel/Loop/Internal

Inputs (5)

NameTypeDefaultDescription
flowFLOW_CONTROL
conditionBOOLEAN
next_indexINT
accumulated1opt*
accumulated2opt*

Outputs (2)

NameTypeDescription
results1*
results2*