Nodes/ComfyUI-Flow-Assistor/Any Passthrough (6 → 1)
ComfyUI Node

Any Passthrough (6 → 1)

Let one of six branches win, without writing a switch node

By Merserk·Created 9 months ago·Updated about a month ago· 6
Any Passthrough (6 → 1)
  • input1
  • input2
  • input3
  • input4
  • input5
  • input6
  • output

Any Passthrough (6 → 1) is a merge node with a simple rule: it outputs the first connected input that isn't null. Six optional inputs, one output, and whichever of them has a real value wins. That single rule quietly solves a genuinely common ComfyUI problem - you have a handful of alternative branches (an image from a loader, an image from an upscaler, an image from an inpaint region) and you want to feed the first one that actually produced something into the rest of the graph. Writing that with core nodes means nesting switches; this collapses it to one node.

How it works

The execution is exactly as dumb as promised: it checks input1 through input6 in order and returns the first value that isn't None. Everything else is ignored. All six inputs are typed as * (any), and the single output is likewise any-typed, so you can merge heterogeneous branches and the downstream node just needs to accept whatever came through.

The inputs are all optional, which is the design detail that makes this useful: you don't have to populate all six, and an unconnected input is effectively skipped. In practice that means you can leave one branch disconnected and the node silently falls through to the next, which is how you get "prefer A, else B, else C" routing without any configuration.

Where it fits: fallback chains (try the cached image, then the newly generated one), routing around optional preprocessing (use the ControlNet preprocessed version if present, otherwise the raw input), or simply tidying a graph that would otherwise fork into a tangle of switch nodes. Pair it with the pack's 1 → 6 passthrough and you've got the two routing primitives a clean modular workflow wants.

Installing

Part of ComfyUI-Flow-Assistor - ComfyUI Manager (search "Flow Assistor") or:

cd ComfyUI/custom_nodes
git clone https://github.com/Merserk/ComfyUI-Flow-Assistor.git

Restart after cloning. Current ComfyUI required (V3-only pack); no extra dependencies.

Where people get burned

The ordering is the whole game: it's always first-non-null in port order, so port 1 always beats port 6 regardless of which branch is "better." If you want priority to change, you rewire, not reconfigure. Second, "first non-null" is not "first that produced valid data" - an empty string, a zero tensor, or a model that's technically present but useless will win the merge, because those aren't null. If your fallback logic depends on valid rather than present, this node will happily hand you the wrong thing. And as with all any-typed nodes, the output type isn't enforced - connect a mismatched downstream node and you'll find out at runtime, not when you drag the wire.

Categoryflow-assistor/flow

Inputs (6)

NameTypeDefaultDescription
input1opt*
input2opt*
input3opt*
input4opt*
input5opt*
input6opt*

Outputs (1)

NameTypeDescription
output*