Nodes/ControlFlowUtils/πŸ›‘ Halt Execution
ComfyUI Node

πŸ›‘ Halt Execution

ComfyUI's Emergency Stop, on a Wire

By VykosXΒ·Created 2 years agoΒ·Updated 2 years agoΒ· 147
πŸ›‘ Halt Execution
  • input
  • run_after
  • *
β—„disablefalseβ–Ί
β—„methodfalseβ–Ί
β—„clear_queuefalseβ–Ί
β—„alert_on_triggerfalseβ–Ί

The ComfyUI cancel button stops a queue, but it can't stop a queue conditionally. "Run this whole loop, but bail out the moment a condition is met" - that needs a node, and Halt Execution (πŸ›‘ Halt Execution, from ControlFlowUtils) is that node.

Think of it as a circuit breaker on a wire: data flows through it, and when you tell it to trip, the execution stops right there. It's how you end an infinite-ish cycle, abort a batch when a check fails, or build a workflow that runs either one branch or the other without dragging the losing branch along.

The inputs that matter

  • input (required) - any data to pass through. This is the wire the breaker sits on; the same data comes out the other side unless the node halts.
  • disable - the master switch. False means "halt allowed"; True means "don't halt, keep going." Convert this widget to an input and you can drive it from an IfConditionSelector - that's the standard pattern: if some condition, halt.
  • method - how to halt:
    • Cancel Prompt (default) - immediately interrupts execution everywhere. Everything downstream dies right now.
    • Block Execution - lets the rest of the graph keep running, but prevents anything connected to this node from executing. This is the softer, surgical option.
  • clear_queue - also wipe the pending queue and switch Auto-Queue off. Essential for cycles: finish your loop, halt, and don't let the queue re-trigger it.
  • alert_on_trigger - raise an error alert when it halts, so you visibly see the stop instead of silent termination.
  • run_after (optional) - a dummy input for ordering: connect any node's output here to force Halt Execution to run after it.

The single output echoes the input. There's no real "result" - this is a control-flow node, not a data node.

Where it shines

Cycles. The Cycle family advances once per queue run, and with Auto-Queue on, it will loop forever unless something stops it. The recommended pattern is literally "halt once the cycle is finished." Wire Cycle End's FINISHED? into the disable input (via an InvertCondition so it halts when finished), and the machine stops itself.

Conditional aborts. You're running a batch and the prompt check comes back bad - halt before you burn a sampler pass. Because the node is a passthrough sitting in your data flow, you can also delay the halt until after an important node by wiring that node into run_after.

Two subtleties from the source: the block-execution method uses ComfyUI's ExecutionBlocker, which needs a recent enough core - older builds throw "please update your ComfyUI." And "Cancel Prompt" is genuinely immediate: it interrupts processing mid-node, so if you halt, whatever sampler was running just stops, no cleanup. Design around that (save early) if a mid-sample halt is a real scenario for you.

Install

Halt Execution ships in VykosX/ControlFlowUtils:

# ComfyUI Manager β†’ Install Custom Nodes β†’ search "ControlFlowUtils"
# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/VykosX/ControlFlowUtils

Restart, find it under 🐺 VykosX-ControlFlowUtils, and combine it with IfConditionSelector + Cycle End for the classic "loop until done, then stop" graph. No dependencies, no models - just a wire you can cut.

Category🐺 VykosX-ControlFlowUtils

Inputs (6)

NameTypeDefaultDescription
disableBOOLEANfalseWill prevent execution from being halted if set to True
methodBOOLEANfalseMethod for how to halt the prompt. Cancel Prompt will interrupt the prompt altogether whereas Block Execution will prevent any nodes that follow this one from running.
clear_queueBOOLEANfalseClear any remaining items in the queue and disable Auto-Queue mode
alert_on_triggerBOOLEANfalseRaise an alert message when this node interrupts execution
input*Any data you wish to forward through this node
run_afteropt*Optional input used only to ensure this node will run after any node you connect to this Input

Outputs (1)

NameTypeDescription
**Will return the same data sent through Input