Any Gate
The node that stops a branch from running at all
- value
- value
Switches get all the attention, but half the time what you actually want isn't "pick branch A or branch B" - it's "don't run this at all." That's the gate's whole job, and it's a job nothing else in a vanilla ComfyUI graph does well. Any Gate sits on a wire and, when its condition goes false, blocks every node downstream from executing. A switch routes around work; a gate refuses to do it.
Where does that matter? The classic case is a conditional save. You check something - a mask came back empty, an audio track is silent, a face detector found zero faces - and you don't want a Save Image or a video encode to fire on garbage. You can't "not wire" a save conditionally; ComfyUI runs the whole graph every queue. The gate gives you a real stop: feed it the value, feed open from Compare, Boolean Reduce, or any test, and the branch behind it simply never executes.
How it works
Two mechanisms, both worth knowing because they're what make the gate different from a lazy shortcut:
- It blocks for real. When the gate is closed it emits ComfyUI's native
ExecutionBlocker, the engine's own signal that everything downstream should be skipped. Your Save Image isn't given an empty image - it isn't run at all. - It's lazy on the way in. The
valueinput is only evaluated if the gate opens. Close the gate and the work that produces that value - an expensive sampler, an upscale, a whole subgraph - never executes either. A closed gate doesn't just stop the save; it stops the generation feeding the save.
Inputs are value (any type), open (a boolean, default true), and an optional message string. The message is the fun bit: when the gate blocks, blocked nodes show Execution Blocked: <your message> in their status. Leave it empty and the branch stops quietly, which is what you want for a routine skip you'll see a thousand times. Give it text when the stop is worth investigating - "no faces detected" - so a later you can tell an intentional skip from a silent bug at a glance.
Wiring it into a real workflow
The pattern reads like a guard clause in a programming language. Detection or a test feeds open; the thing you want to conditionally keep or save feeds value; everything downstream of the gate's output is the guarded block.
[Face detector count] → [Compare: count > 0] → [Any Gate open]
[Any Gate value] ← [full pipeline]
↓
[Save Image]
If the comparison comes back false, neither the pipeline nor the save runs. Wire the boolean output of something like WAS Compare Any or Boolean Reduce straight in and you've got an if/else with only an if - sometimes that's all you need.
Gotchas
- A closed gate hides errors. Everything behind it is skipped, including validation. If the gated branch would have failed loudly, you'll never see it until the gate opens. Don't gate the thing you're debugging.
- Gate vs. switch, pick by intent. If the branch should still do something when the condition is false - just something else - that's a switch's job, and WAS has
Any Input Switchfor exactly that. The gate is for "run or don't run." Muting a branch by hand (right-click → mute) is the manual version of the same idea; the gate makes it data-driven and per-run. - If you find yourself gating the same value in five places, reconsider: you may actually want one gate upstream of the whole block, since a single blocked wire stops everything downstream of it.
Installing
This is part of WAS Node Suite v3 (WASasquatch/was-node-suite-comfyui) - MIT, going since 2023, one of the packs listed in any roundup of ComfyUI essentials. The v3 rewrite needs nothing extra installed for logic nodes like this one: no pip packages, no models. It's written against ComfyUI's newer backend node API, so you need ComfyUI 0.14.0+.
Install from ComfyUI Manager by searching WAS Node Suite v3, or:
cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui
then restart ComfyUI. If the node doesn't appear in the menu, you're almost certainly on a ComfyUI older than 0.14.0 - update first, then look.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| value | COMFY_MATCHTYPE_V3 | What to pass on. It is only worked out when the gate opens, so a closed gate also skips the work behind it. | |
| open | BOOLEAN | true | true lets the value through; false stops every node downstream. Wire it from Compare, Boolean Reduce or any test. |
| messageopt | STRING | Shown on the blocked nodes as `Execution Blocked: <message>`. Left empty the branch stops quietly, which is what a routine skip wants. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | COMFY_MATCHTYPE_V3 | The value when the gate is open. Nothing runs downstream when it is not. |