ComfyUI Node

Any Switch

One value in, two outputs out, and one of them is None

By ArtemKo7v·Created 28 days ago·Updated 3 days ago· 1
Any Switch
  • any
  • any_out_1
  • any_out_2
enabledtrue

Any Switch is a traffic light for a finished value. One input comes in, and a toggle decides which of two outputs it leaves by. That's the entire node - and the thing that bites people isn't the routing, it's what's sitting in the socket you didn't choose.

The mechanism, in full

Straight from the source, the whole function:

def switch(self, any, enabled):
    return (any, None) if enabled else (None, any)

So with enabled true, any_out_1 gets your value and any_out_2 gets Python None. With it false, that's reversed. Inputs are any (required, wildcard) and enabled (BOOLEAN, default true - meaning output 1 is the default path). Outputs are any_out_1 and any_out_2, both wildcard.

Note which shape of switch this is. The plumbing layer has two of them. A fallback switch walks its inputs and passes the first one that isn't empty - rgthree's Any Switch is that node, and it's the one you'll land on if you google the name. This pack's version is the other flavor: a manual A/B valve with a selector you flip yourself. Same name, opposite job. If you expected "choose the first non-null input automatically", you installed the wrong pack.

The None is the whole story

ComfyUI has no lazy evaluation unless a node asks for it, and this pack never asks - there's no lazy flag anywhere in its source. Both switch outputs are produced on every run, and the dead one carries None down its wire. Downstream nodes still execute.

That means Any Switch routes, it doesn't mute. Whatever is plugged into the untaken output receives nothing and has to cope. If that's an optional input, or another switch or fallback node, everything is fine - that's the "leave a downstream optional input unconnected at runtime" pattern the plumbing layer is built on. If it's a VAE Decode, a Save Image, or anything else expecting a real tensor, you get a run-time error naming that node, not the switch, which is what makes it confusing to debug. It's the standard complaint whenever people toggle branches this way: disable a path and the nodes behind it start throwing errors about a missing value.

So before you wire it, decide what the loser of this coin toss receives. Two save paths with different filenames is a fine use. Two loaders, where only one can survive a None, is a trap.

Where it earns its place

The honest answer is: anywhere you'd otherwise rewire a graph by hand between runs. Route a decoded image to a Preview Image or a Save Image depending on how finished you think it is. Route a latent to skip-a-detailer versus run-a-detailer. Convert enabled to an input (right-click, convert to input) and an upstream BOOLEAN can drive it - the pack's own Boolean Random will flip the branch for you each run, which is a cheap way to A/B two post-processing paths over an afternoon.

Both sockets are wildcard, so nothing type-checks your wiring. Wire it backwards and you'll get the wrong branch, quietly, until you notice the filenames.

Installing it

Same as the rest of the pack, and it's painless: MIT licensed, brand new (September 2026), and no Python dependencies at all - empty dependency list in pyproject.toml, no requirements.txt. Nothing to conflict with your existing environment.

Manager → search ComfyUI Useful Stuff Nodes → Install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/ArtemKo7v/ComfyUI-UsefulStuffNodes

then restart ComfyUI and hard-reload the browser tab (Ctrl+Shift+R). This node has no frontend extension of its own, but its packmates do, and a stale page is the usual reason a pack looks half-installed.

Troubleshooting

Downstream errors after a run. Almost always the None on the dead branch. Check what the untaken output feeds before you check anything else.

The wrong branch fired. enabled true means output 1 - that's the default, so a node you never touched is already routing to the top socket. Swap your links rather than your logic.

Missing node on someone else's workflow. The JSON carries the class name ArtemKo7vUsefulStuffNodesAnySwitch, and this is a very new pack, so borrowed workflows will flag it until you install it.

Nothing saves from the dead path. Expected: with None in the socket, the downstream save produces nothing. If you wanted both paths to always produce output, you don't want a switch - you want two branches that both just run.

Verdict: the least interesting node in the pack and the easiest one to hurt yourself with. Reach for it when you want a manual valve you can flip, and reach for a group bypass when what you actually want is for half the graph to stop running.

CategoryArtemKo7v

Inputs (2)

NameTypeDefaultDescription
any*
enabledBOOLEANtrue

Outputs (2)

NameTypeDescription
any_out_1*
any_out_2*