Nodes/XENodes/Multi-Switch
ComfyUI Node

Multi-Switch

The switch that only runs the branch you picked

By xeinherjer-dev·Created 6 months ago·Updated a day ago· 2
Multi-Switch
  • inputs
  • output
  • select
select0

Every big ComfyUI workflow eventually needs the same thing: one node that lets you flip between a handful of alternatives without ripping out wires. That's this. Multi-Switch is a general-purpose selector - up to 50 inputs, one select index, one output - and it's the node people actually mean when they say "I need an rgthree-style multi-switch that works on Nodes 2.0." It ships in the ComfyUI-XENodes pack, which is one author's answer to the late-2025 Nodes 2.0 rewrite that broke the old plumbing packs: it's written natively against the newer comfy_api.latest node API, so it renders fine on the Vue frontend that made rgthree's switches stack their widgets into mush.

The mechanism is where it gets interesting. A dumb switch evaluates every input it's fed, because the engine doesn't know which branch you want until the node runs. XENodes' Multi-Switch uses lazy inputs instead: through its check_lazy_status, it tells the engine exactly which one input it's about to read, so only the selected branch executes. That's not a micro-optimization - it's the difference between a workflow that keeps two checkpoints or two ControlNet stacks alive and one where the unselected branch either wastes VRAM or errors out on a missing model. A selector with select = -1 is the "skip" position: it outputs None and evaluates nothing at all, which is how you make an entire branch go quiet from one number.

The inputs and outputs are refreshingly few:

  • select (INT, -1 to 49) - which input to pass through. Wire it to a Slider, a seed, or a primitive and you've got a switch you can flip programmatically.
  • inputs - an auto-growing wildcard (*) input. It accepts anything: IMAGE, LATENT, MODEL, STRING, whatever. Slots appear as you connect.
  • output - passes whatever you selected through unchanged, matching its type.
  • select (second output, INT) - echoes the index back out, handy for labelling or downstream logic.

On the canvas the node grows input rows as you wire them, and it renders little buttons labeled with the source node's name, so you click "KSampler A" instead of counting wires. Right-click offers a "hide connections" toggle when you want the compact look.

Install it the usual way: ComfyUI Manager, search "ComfyUI-XENodes", or

cd ComfyUI/custom_nodes
git clone https://github.com/xeinherjer-dev/ComfyUI-XENodes.git xenodes

then restart ComfyUI. No models, no pip requirements to babysit - the pack's requirements.txt is empty and its only declared dependency, imageio-ffmpeg, is a video fallback you won't touch for this node.

Two things to watch. First, the whole pack loads as one unit: __init__.py imports every node module, so if a sibling node (SaveAudio, say) hits a missing av import, Multi-Switch won't appear either - check the ComfyUI console for the real error. Second, because the type is matched rather than hard-coded, don't expect the output socket to display a fixed type before you connect something; that's normal, wire it and it resolves. And honestly, the one real downside is the same as every wildcard switch: with everything accepted, a mis-wire can pass a latent into something that wanted an image and fail at execution. That's the price of routing power, and for a node whose whole job is not caring what flows through, it's a fair one.

Categoryxenodes/utils

Inputs (2)

NameTypeDefaultDescription
selectINT0-1–49
inputsCOMFY_AUTOGROW_V3

Outputs (2)

NameTypeDescription
outputCOMFY_MATCHTYPE_V3
selectINT