Nodes/Allma Nodes/Allma Fallback (first valid)
ComfyUI Node

Allma Fallback (first valid)

Whichever branch is still wired up wins

By OliveiraNickolas·Created 2 months ago·Updated 21 days ago· 1
Allma Fallback (first valid)
  • values
  • output

Sooner or later every workflow grows two or three ways to do the same stage - the fast model and the slow one, the upscale and the skip - and exactly one place downstream to plug the winner into. Rewiring that by hand is the tax nobody mentions. And you can't fix it with a boolean, because bypassing a node changes the graph, and the graph is frozen the moment you hit queue.

Allma Fallback takes many inputs and passes the first one that actually arrived, in slot order. If a branch is switched off upstream, its wire never delivers, the slot reads empty, and the value falls through to the next one.

Where it sits in ComfyUI's plumbing

This is the first-non-null shape, which is a different animal from a normal switch. An A/B switch has a selector - you point it at input 1 or input 2. A fallback switch has no selector at all: it walks its inputs and passes the first non-empty one. rgthree's Any Switch is the canonical version, and it's the shape that lets you keep several optional upstream branches and one consumer that doesn't care which is live.

AllmaNodes is mostly an LLM prompt-enhancer for the Allma backend - but this node is in the pack's Allma/logic group and touches no model, no API and no key.

How it actually works

Two details do all the work.

Only None is skipped. The node doesn't test truthiness, deliberately: an empty string, a zero and an all-black image are all values somebody chose to send, and a torch tensor has no truth value to test anyway. If a slot has anything in it, that's your answer.

Slot order, not connection order. Slot 2 stays ahead of slot 3 no matter which one you wired first. The slots are autogrow, up to 24 (value_1 … value_24), so a new one appears as you fill the last.

And the slots are lazy - the node asks for one at a time and stops the moment one answers. Wire three upscalers in and only the one that wins ever runs. That laziness needed a nudge: ComfyUI's scheduler reads a V3 node's raw template rather than its grown inputs, so dynamic slots read as non-lazy and every branch gets scheduled anyway. The pack ships a small wrapper for that; the author's measurement on three four-second branches was 4 seconds instead of 12.3.

The inputs and outputs that matter

There are no widgets to set.

  • values - the autogrow input group (value_1, value_2, …). Wildcard type: a latent, an image, a string, a model all plug in fine.
  • output, also wildcard - wire it straight into whatever consumes the stage.

The wildcard socket is why this works, and it's also the honest cost: a wire that can carry anything tells you nothing at a glance about what's in it. That's the same trade the community grumbles about in the "stop using anything/everywhere" arguments. Use it where the alternative is genuinely rewiring a graph, not as a default connector.

Pairing it with Allma Muter is the intended trick. A muted branch is removed from the prompt entirely, so its wire never arrives, so the fallback slides to the next slot. Three ways of producing the same image sitting side by side, and whichever one you left running is the one that comes out.

One thing to get right: muting and bypassing are different here. A bypassed branch still hands its input through to its output, so it does arrive, and the fallback will happily use it. If you want a stage cut out of the middle of a chain, that's a muter's job, not a bypass's.

Install

ComfyUI Manager → search Allma Nodes (the registry display name; publisher allma-lab), or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/OliveiraNickolas/AllmaNodes

Restart ComfyUI after. Nothing to pip install - requirements.txt is empty and pyproject.toml declares zero dependencies. The LLM half of the pack wants an Allma backend running; this node doesn't care.

Two notes. The pack is written against the newer V3 node API (from comfy_api.latest import io) and registers through comfy_entrypoint, so on an old ComfyUI build the whole pack fails to import and nothing appears - not just one node. And it ships browser-side JavaScript, so hard-refresh the page (Ctrl+Shift+R) after installing or updating.

Where people get burned

Slots come back shuffled. Not Allma's fault - ComfyUI appends grown slots after declared ones, so a node with dynamic inputs often reloads as value_1, value_4, value_9 … and then the rest. Right-click the node and pick "Fix slot order (Allma)"; the pack's web/allma_slotfix.js puts families back in first-appearance order with numbers ascending, and it works on other packs' nodes too.

"Every slot is empty." That's the node refusing to pass nothing on, and it's usually accurate: you turned every branch off with a muter. Leave one live, or wire a final slot that always carries a value.

Debugging gets harder, not easier. With * sockets the usual first move - read the wire type - is gone. When something downstream misbehaves, the fallback is the first suspect, and you can't tell by looking.

CategoryAllma/logic

Inputs (1)

NameTypeDefaultDescription
valuesCOMFY_AUTOGROW_V3—

Outputs (1)

NameTypeDescription
output*—