Nodes/ComfyUI-Select-Any/Select Any Values Node
ComfyUI Node

Select Any Values Node

The node that hands you whichever input actually has a value

By hwhaocool·Created 2 years ago·Updated 2 years ago· 2
Select Any Values Node
  • input1
  • input2
  • input3
  • input4
  • input5
  • input6
  • input7
  • input8
  • output
enabletrue
strategy

ComfyUI has no core node that just says "pass along whichever of these wires is actually connected." You get type-specific switches - Switch (latent), Switch (image), Switch (conditioning) - and for everything else people bolt on a pack. Select Any Values is one tiny corner of that: eight any-type inputs, one output, and a dropdown that decides which input wins. That's the whole node, and honestly that's fine.

The name is a bit of a lie, though. Nothing here gets "enabled" per-input. It's a first-non-empty-wire picker, and once you read it that way it slots into a genuinely useful spot: conditional workflows where some upstream branch produces a value and others produce nothing, and you want the one that actually came back.

How it works

The mechanism is embarrassingly simple. The node collects input1 through input8 into a list and returns the first item that isn't None. That's the entire logic. strategy just changes the scan order:

  • FirstEnable - checks input1 first, returns the first connected value it finds.
  • LastEnable - reverses the list, so input8 wins.

Everything connected is compared with != None, not "is truthy." So an empty string, 0, or False all count as active. Only a genuinely disconnected wire leaves a None in the list. In a world where an empty prompt string might legitimately be what you want passed through, that's the right call - but it means the node can't tell "empty" from "real," so plan around it.

The inputs that matter

  • input1–input8 - all * (any-type) inputs with forceInput, meaning there are no widgets to type into. You wire values in or the input simply isn't there. The any-type trick comes from pythongosssss and means these accept images, latents, models, conditioning, strings, whatever - one node, no type juggling.
  • strategy - the FirstEnable / LastEnable dropdown described above.
  • enable - here's the gotcha worth knowing up front: it does nothing. It's accepted by the node's function signature but never read anywhere in the body. Flip the checkbox off and the node still passes your first connected input straight through. If you want an actual off switch, bypass the node with Ctrl+B. A dead toggle like this is usually a sign the author changed the design mid-way and forgot to clean up - this pack never got past one commit.

The single output is, predictably, output - also any-type, so it plugs into whatever the inputs were plugged from. If all eight inputs are disconnected, it returns None, and whatever you wired the output into gets fed a null.

Installing it

It's a two-file pack with zero dependencies beyond ComfyUI itself (the __init__.py imports torch just to print your versions, which it already has). No models, no weights, nothing to download. Either route works:

  • ComfyUI Manager: search for "ComfyUI-Select-Any" (author hwhaocool) and install.
  • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/hwhaocool/ComfyUI-Select-Any, then restart ComfyUI.

It's registered on the Comfy Registry too, so it shows up in the in-app install dialog.

Where people get burned

  • The enable checkbox is decorative. Already covered, but it's the #1 thing to trip on because the UI implies it gates the node.
  • An all-None result breaks whatever it feeds. If every branch was disconnected, the output is None; wire that into a model or latent slot and ComfyUI throws an execution error that looks confusing until you realize the picker is the culprit.
  • Empty-but-connected values are "active." A branch that returns "" or a zero tensor beats a None from another branch. If your branches return sentinel empties instead of None, order your strategy accordingly.
  • It's unmaintained. Last commit was July 2024, it's a single-node pack by one author, and it has essentially zero community footprint - I couldn't find a single Reddit mention. Don't expect updates, bug fixes, or a helping hand in the issues.

Should you reach for it?

For most "pick one of these" jobs, no - you'll get more out of rgthree-style switch nodes, a core Reroute, or just Ctrl+B bypassing a branch, all of which are better maintained and more featureful. Where this little node actually earns its keep is merging branches that produce None: when exactly one of several expensive upstream paths returns a value and you don't know which, this is a dead-simple, type-agnostic way to let it through. It won't change your life, but it's 20 lines of code that does one job without adding anything heavy - and after this pack, that's a feature.

CategorySelectAny

Inputs (10)

NameTypeDefaultDescription
enableBOOLEANtrue
strategyCOMBO2 options: FirstEnable, LastEnable
input1opt*
input2opt*
input3opt*
input4opt*
input5opt*
input6opt*
input7opt*
input8opt*

Outputs (1)

NameTypeDescription
output*