Nodes/Vantage-NodesV2/Switch index (VantageV2)
ComfyUI Node

Switch index (VantageV2)

A numbered port selector for graphs that pick for you

By vantagewithai·Created 15 days ago·Updated 11 days ago· 3
Switch index (VantageV2)
  • any_01
  • any_02
  • any_03
  • any_04
  • any_05
  • *
◄index0►

Most switches are human decisions. Switch index is for the other case: something upstream produced a number, and the number decides which wire survives.

What it does

One integer, index. Whatever socket sits at that zero-based position gets passed through. Index 0 is any_01, index 1 is any_02, and so on through the five optional any_* sockets, all wildcard-typed, which expand with a spare as you connect more.

A small heads-up because two sources disagree: the field's own tooltip and the node's code both say 0 selects any_01, and the code is what runs - kwargs["any_%02d" % (index + 1)]. The README's prose talks about input_0/input_1 naming borrowed from the condition switches. Same behaviour, different label; trust the tooltip.

The other thing to internalise: there's no fallback. Unconnected, None, or out of range all return None. It won't quietly slide to the next live socket - that's Any Switch's job, and mixing the two up produces a graph that looks fine and renders nothing.

Where it earns its place

You want a workflow where one number chooses the path. A quality tier from a value switch, a variant selector driven by a seed, a "which of three upscalers" setting computed elsewhere. Convert the index widget to an input, wire your INT in, and now the choice travels down a wire like everything else.

This is the A/B valve shape from the KB's plumbing taxonomy - the node that "passes whichever input you point at - a manual routing valve." Keep that mental model and the pack stays readable: fallback switch for "whichever branch is alive", index switch for "whatever I told you".

The cost you're paying

Switch index is not lazy. Every connected socket gets evaluated, so putting three expensive pipelines behind it doesn't buy you the compute of two. If you're choosing between two full generation branches - an SDXL path and a Flux path, say - reach for Int Switch, Float Switch or String Switch instead, which are written with lazy data inputs and only request the branch that wins.

The pipeline behind this node gets tidier, not cheaper. That's still a real win in a 60-node graph; just don't expect the queue time to drop.

Output is a single socket named * typed *. It connects to anything, and nothing is checked until execution, so a mismatched type surfaces as a runtime error deep in whatever you plugged it into.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/vantagewithai/Vantage-NodesV2.git

Restart ComfyUI, hard-refresh the browser, and search "Switch index" or browse Vantage/Utils. ComfyUI Manager can install it too - the pack is published under the vantagewithai publisher ID - but the git clone above is what the README documents.

No dependency install: the repo ships no requirements and its pyproject.toml lists no packages, because it lives entirely on what ComfyUI already provides. It does require a reasonably current ComfyUI with the modern frontend APIs; older installs are the number one reason these nodes don't show up at all.

Troubleshooting

None coming out is almost always one of three things: the index points past your last connection (connected sockets are 1-based in your head and 0-based in the field - the classic off-by-one), the socket at that index is wired but upstream produced nothing, or an upstream node is muted and passing None through.

Also worth knowing: because the index is a required INT, the node always has one - if you convert the widget to an input and leave the input unwired, that's a validation error rather than a silent zero.

And if you edit the pack and the node's socket count looks stale, drop a new instance on the canvas. The README is explicit that schema changes require a fresh node; old instances keep the old shape.

CategoryVantage/Utils

Inputs (6)

NameTypeDefaultDescription
indexINT00–2147483647Zero-based input index: 0 selects any_01.
any_01opt*—
any_02opt*—
any_03opt*—
any_04opt*—
any_05opt*—

Outputs (1)

NameTypeDescription
**—