Stop If Output
The kill switch that aborts a bad run
- dependency
Some runs shouldn't be allowed to finish, and in a node graph the way you enforce that is a guard: compute a condition, and if it's bad, abort. JN_StopIfOutput is JNComfy's abort node. Wire it a boolean, and when that boolean is true the whole run dies with an error message of your choosing. It's a panic button you can reason about.
How it works
It's almost embarrassingly simple under the hood - if condition: raise Exception(title). The condition input is a BOOLEAN (default false, so it does nothing until you explicitly feed it true), and when it fires, the exception's message is whatever you put in title. That error message is what shows up in ComfyUI's queue and console when the run fails. It's an output node with no outputs - its only job is to be the thing that ends execution.
Two inputs matter, plus one for ordering:
- condition - the switch. Anything that produces a
BOOLEAN: a comparison fromJN_LogicOperation, a check from a custom node, a value you convert with the pack's primitive converters. - title - your error message. Keep it human-readable, because this is literally what you'll see when it fires.
- dependency (multiple inputs) - forces the node to run after the nodes you wire in. This is important: an abort condition that's computed too late is worthless, so make the Stop depend on whatever computes the check.
There's also a non-output sibling, JN_StopIf, which has a flow pass-through - it raises the same way when the condition is true, but when the condition is false it just passes flow through so the chain continues. StopIfOutput is the "terminal" flavor: no continuation, period.
When you'd reach for it
Guards and validation. Stop a batch if a mask comes back empty. Abort if a face-detection step found nothing. Bail out of a workflow if some resource check fails before you waste ten minutes sampling a doomed run. The pattern is always the same: compute a boolean, invert or combine it with JN_BooleanOperation, feed the result to condition, write a message that tells you why.
It's also handy for manual interlocking - you can leave condition as a widget and flip it to true to deliberately halt a workflow at a known point while you poke at the state.
Install
Part of JNComfy. ComfyUI Manager → search "JNComfy" → Install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/jn-jairo/jn_comfyui
restart, and pip install -r requirements.txt inside the folder if you're installing manually. It's pure Python - the pack's heavy requirements (torchaudio, librosa, rembg, spandrel…) belong to other sections and are irrelevant here, though Manager will install them all anyway.
Gotchas
- An aborted run is a failed run. ComfyUI reports it as an error, which means the queue entry fails and downstream work is skipped. That's the point - but don't use this node if you actually want a graceful early-exit that still counts as success.
- Empty
titlegives you a confusing failure. "Exception: " with nothing after it tells you nothing. Always set it. - The pack patches ComfyUI on startup, and a few other patch-heavy packs don't always play nice - if you see "Failed to import module" lines in the console after install, suspect a collision before you suspect this node.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| conditionopt | BOOLEAN | false | — |
| titleopt | STRING | — | |
| dependencyopt | * | — |
Outputs (0)
No outputs