Nodes/ComfyUI-Xz3r0-Nodes/XPipeRecursive
ComfyUI Node

XPipeRecursive

First non-empty value in the order you pick — a fallback chain for the XPipe bundle

By Xz3r0-M·Created 8 months ago·Updated about 6 hours ago· 13
XPipeRecursive
  • xpipe_in
  • recursive_output
empty_string_as_nonefalse
recursive_order1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50

Sometimes you don't want a bundle's contents - you want a value, and you don't care which one as long as it's real. That's the whole job of XPipeRecursive. You hand it an XPipe bundle and tell it the order in which to look at the slots; it scans in that order and returns the first non-empty value it finds. If you've ever written a fallback chain - "use the direct input, else the cache, else the default" - this is that, as a node.

How it works

Three inputs, one output:

  • xpipe_in - the bundle to search. Standard XPipe bundle, slots 1 to 50.
  • recursive_order - the search order as dash-separated slot numbers. The default is 1-2-3-...-50, but you can write 1-3-5 to skip straight to your preferred slots, or 50-1-2 to check the last slot first. The order is what you make it.
  • empty_string_as_none - off by default. Turn it on and an exact empty string ("") is treated like None, so the scan keeps going instead of handing you a blank.

The output, recursive_output, is the first non-empty value found. Its type is a wildcard, so it matches whatever the winning slot actually holds - a number, an image, a string, whatever. If nothing in the bundle is non-empty, you get None.

The strict bits

The node validates recursive_order hard, and the errors are worth knowing so you don't fight them: only digits, only slots 1–50, no duplicates, no empty fragments. "1-3-3" is rejected, "1-50" is fine. That strictness is genuinely helpful - a duplicated slot in a fallback chain is a silent logic bug, and this refuses to ship one.

Installing it

XPipeRecursive ships in ComfyUI-Xz3r0-Nodes (by Xz3r0-M) under ♾️ Xz3r0/Workflow-Processing. ComfyUI Manager: search ComfyUI-Xz3r0-Nodes and install. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/Xz3r0-M/ComfyUI-Xz3r0-Nodes.git
cd ComfyUI-Xz3r0-Nodes
pip install -r requirements.txt

Restart ComfyUI after. No models, no heavy dependencies - pure plumbing.

When it earns its keep

This one shines in config-style workflows: several nodes write candidate values into a bundle, and XPipeRecursive picks the first real one in priority order. It also pairs naturally with XPipeGate's "always a valid bundle" behavior - a gate can zero out channels and the recursive node will skip right past them to the next live one. The main trap is the same one every "first match wins" tool has: order matters, and the default 1-50 order means slot 1 always beats slot 50, so if your priority is "newest wins" you need to write the order backwards yourself.

Category♾️ Xz3r0/Workflow-Processing

Inputs (3)

NameTypeDefaultDescription
xpipe_inxpipeThe XPipe bundle to search through, following your recursive_order (slots 1-50)
empty_string_as_noneBOOLEANfalseTreat an exact empty string as None and continue scanning
recursive_orderSTRING1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50Slot order to scan, numbers separated by '-' (example: 1-3-5 or 50-1-2). Only slots 1-50 allowed; no duplicates.

Outputs (1)

NameTypeDescription
recursive_output*The first non-empty value found while scanning in your specified order.