MD: Multi-Way Switch (5-Path)
A 5-path router for any data type, with a crash-proof fallback
- input_1
- input_2
- input_3
- input_4
- input_5
- default_value
- selected_output
ComfyUI switches are the plumbing that make interactive workflows possible: pick one of several inputs and route it through. MD_MultiSwitch is the pack's version of that idea, and it does the two things that matter - five paths instead of two, and a default_value fallback so an unconnected slot doesn't kill your queue.
The "any type" trick is worth calling out because it's rarer than it should be. Each input is typed as wildcard, so you can switch between two models, three latents, five conditioning streams, or a mix - the same node routes whatever you plug in. Most switch nodes in the ecosystem are per-type; this one doesn't care.
The inputs that matter
The whole thing is one control plus five inputs:
select_index(1–5) - which path passes through. The node is selected by index rather than by a boolean per input, which keeps the graph clean.input_1throughinput_5- the five candidate values, any type. Connect what you want to switch between.default_value- the fallback output when the selected slot is empty or the index is out of range. This is the feature that saves you: without it, an unconnected input would throw and ComfyUI's lazy execution would make the whole branch a mystery error. With it, the node silently outputs your fallback.
Output is a single wildcard selected_output.
Where you'd actually use it
The obvious case is A/B testing: wire different checkpoints, LoRAs, or prompt-engineering branches into inputs 1–5, drive select_index from a random seed or a counter, and batch out comparisons without touching the graph. It's also the standard building block for "model rotator" workflows - pull a different model each run so a multi-frame or multi-image project has consistent variety. And because it accepts conditioning and latent types, you can use it to hot-swap whole pipeline branches.
It doesn't have the "any" type's typical downside visible from the outside - no auto-cast weirdness - and unlike some multi-switch nodes it doesn't try to detect the connected type and specialize. It just routes. That's a feature.
The honest caveats
Five inputs is the hard limit; if you need more paths, this isn't it. There's no UI dropdown override beyond the int widget, so driving it from a widget is manual. And like everything in this pack, you're installing the whole MD Nodes bundle to get one logic node - the requirements.txt pulls in the audio stack, matplotlib, and assorted client libraries whether you use them or not.
Installing
cd path/to/ComfyUI/custom_nodes
git clone https://github.com/MDMAchine/ComfyUI_MD_Nodes.git
cd ComfyUI_MD_Nodes && pip install -r requirements.txt
Or via ComfyUI Manager - search MD Nodes - then restart ComfyUI.
MD_MultiSwitch is the rare utility node that just works: five inputs, one index, a crash-proof fallback, and no opinions about what you route through it. If you already have the pack installed, it's a no-brainer addition to any branching workflow. If you're only after a switch, plenty of lighter single-purpose packs exist - this one's best enjoyed as part of the MD bundle.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| select_index | INT | 11–5 | PATH INDEX • Purpose: Selects which of the 5 inputs to pass through. • Range: 1 to 5. |
| input_1opt | * | PATH 1 • Selected if Index = 1. | |
| input_2opt | * | PATH 2 • Selected if Index = 2. | |
| input_3opt | * | PATH 3 • Selected if Index = 3. | |
| input_4opt | * | PATH 4 • Selected if Index = 4. | |
| input_5opt | * | PATH 5 • Selected if Index = 5. | |
| default_valueopt | * | FALLBACK VALUE • Purpose: Output if the selected index is empty or out of range. ⭐ Prevents workflow crashes from null outputs. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| selected_output | * | — |