Extensions/Lazy Fallback Switch
ComfyUI Extension

Lazy Fallback Switch

Lazy indexed switches with a default route for ComfyUI.

By SparknightLLC·Created 22 days ago·Updated 22 days ago· 0
SparknightLLC/ComfyUI-LazyFallbackSwitch
Nodes
On cloudLocal install
Stars0
Updated22 days ago
Readme

ComfyUI-LazyFallbackSwitch

Compact lazy switches with a default route for ComfyUI.

workflow

Purpose

Both nodes select an input named valueN using an integer index. If that input is not connected, the node returns default instead. If default is also unconnected, it returns None.

Only the selected route is evaluated. The default branch is also lazy, so it is evaluated only when no matching input is connected.

index = 2
value2 is connected -> evaluate and return value2

index = 7
value7 is not connected -> evaluate and return default

Nodes

| Node | Routes | Recommended use | | --- | --- | --- | | Lazy Fallback Switch | Fixed value0 through value9 | General use. Does not depend on lazy Autogrow scheduling. | | Lazy Fallback Switch (Autogrow) | Starts with value0 through value9 and grows through value99 | Workflows that need more than ten routes. See the compatibility note below. |

The fixed node follows the same ten-route range used by other indexed switch nodes. An index outside 0 through 9 uses default.

The Autogrow node supports any integer index. Inputs beyond value99, including negative indices, use default.

Inputs

  • index: Selects the corresponding valueN input.
  • default: Optional. Used when the selected valueN input is not connected. If omitted, the fallback value is None.
  • value0 ... value9: Optional routes on both nodes.
  • value10 ... value99: Additional optional routes on the Autogrow variant, created as needed.

All value inputs, the default input, and the output share one ComfyUI type.

Requirements

A recent ComfyUI build with V3 MatchType support is required. The Autogrow variant additionally requires V3 Autogrow.

[!IMPORTANT] At the time of writing, ComfyUI does not preserve lazy metadata from expanded V3 Autogrow inputs during dependency discovery. The scheduler fix is tracked in ComfyUI PR #15103. Until that fix is available in your ComfyUI version, connected Autogrow routes may all execute; use the fixed Lazy Fallback Switch instead.

The node pack has no third-party Python dependencies.

Installation

Clone this repository into ComfyUI/custom_nodes and restart ComfyUI:

git clone https://github.com/SparknightLLC/ComfyUI-LazyFallbackSwitch.git

The node appears under Sparknight/Logic.

Similar Nodes

  • Akatz Loop Nodes provides the Lazy Index Switch that inspired this node. Its selected input must be connected.
  • ComfyUI-KJNodes provides a lazy boolean switch.
  • Fill-Nodes provides a five-case string switch with a default input. A matched but unconnected case does not fall through to its default.

These nodes are intentionally narrow: integer routing, a true missing-route fallback, no third-party dependencies, and no frontend or graph monkey-patching.