Nodes/ComfyUI Impact Pack/Switch (SEGS/legacy)
ComfyUI Node Runs on cloud

Switch (SEGS/legacy)

Pick one input out of many by number

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
Switch (SEGS/legacy)
  • input1
  • selected_value
  • selected_label
  • selected_index
select1
sel_modefalse

A switch node is a multiplexer: several inputs go in, a selector number picks one, and that one comes out. Switch (SEGS/legacy) is Impact Pack's version - despite the name it's the pack's general "Switch (Any)" style node, whose type gets decided by whatever you plug into it. You use it to flip between branches of a workflow without rewiring: A/B two detection setups, toggle between a detailed path and a passthrough, or route based on a value from elsewhere in the graph.

The "legacy" tag is a hint. The pack has newer switch nodes, and ltdrdata keeps the older signatures around so existing workflows don't break - a nod to the fact that people build graphs and don't want them to rot. If you're starting fresh, this still works fine; just know there are siblings.

How it works

The node takes a numbered set of optional inputs and forwards exactly one of them, chosen by the select value. The README's description of the switch family: "Among multiple inputs, it selects the input designated by the selector and outputs it. The first input must be provided, while the others are optional." The type is inferred from what you connect - connect SEGS and it passes SEGS, connect images and it passes images - which is why it uses a wildcard (*) type internally, and why ComfyUI may grumble about type validation even when it works.

The inputs and outputs

  • select (default 1) - which input to pass through, counting from 1. This is the knob you drive, and you can wire it from another node to make the routing dynamic.
  • sel_mode (default false) - controls how the selection responds when driven by an input versus set by hand, so a changing upstream value takes effect the way you expect.
  • input1 (and the slots that appear as you connect more) - the candidate inputs. The first is required; connecting inputs adds more slots.

Three outputs: selected_value (the chosen input, same type as what went in), selected_label (a STRING naming what was picked), and selected_index (the INT that was selected). The label and index outputs are handy for debugging or for feeding the choice into downstream logic.

How to install it

ComfyUI Manager: search ComfyUI Impact Pack, install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack, install requirements into ComfyUI's Python (pip install -r requirements.txt, or ..\..\..\python_embeded\python.exe -m pip install -r requirements.txt on Windows portable), restart. Auto-install ended at v7.6. A small SAM model downloads to ComfyUI/models/sams on first launch.

Common issues

"The input specified by the selector is not connected" error. This is the one that bites, and the README warns about it directly: if select points at a slot you never wired, "an error may occur." Make sure the numbered input you're selecting actually has something plugged into it. Off-by-one counting (slots start at 1) is the usual culprit.

Type validation warnings. Because the node uses a wildcard type, ComfyUI's validator may flag connections it can't statically prove are safe. The README calls this out as an ecosystem-wide thing that'll go away once ComfyUI supports dynamic types; until then it "functions without issues" even when the message appears.

You want auto-selection, not a fixed number. Drive select from an upstream INT - a logic node, a value receiver - rather than setting it by hand, and the switch becomes a real conditional branch instead of a manual toggle.

CategoryImpactPack/Util

Inputs (3)

NameTypeDefaultDescription
selectINT11–999999The input number you want to output among the inputs
sel_modeBOOLEANfalseIn the case of 'select_on_execution', the selection is dynamically determined at the time of workflow execution. 'select_on_prompt' is an option that exists for older versions of ComfyUI, and it makes the decision before the workflow execution.
input1opt*Any input. When connected, one more input slot is added.

Outputs (3)

NameTypeDescription
selected_value*Output is generated only from the input chosen by the 'select' value.
selected_labelSTRINGSlot label of the selected input slot
selected_indexINTOutputs the select value as is