πͺ Fallback Any Batch
Batch Anything, Even When Some Slots Are Empty
- input1
- input2
- input3
- input4
- input5
- input6
- batch
ComfyUI's built-in batching is picky. Batch two images, fine - but try to batch a string, a tensor, and a list, or try to batch when one of your inputs is missing, and stock nodes throw a fit. FallbackAnyBatch (πͺ Fallback Any Batch, from ControlFlowUtils) is the "whatever, just make it a batch" node: six optional inputs of any type, one output, and missing inputs are silently ignored.
The name comes from its best use case - inside loops, where the first iteration often has only one image while later iterations have several. The author's own words: "Invaluable to use within loops and cycles when you're trying to combine multiple image generations but the first iteration of the loop only has the one image!"
How it works
One required setting, six optional inputs, one output:
- method_for_images - the resampling algorithm used when image tensors of different sizes get joined. Default
lanczos, with nearest-exact, bilinear, area, and bicubic as alternatives. Leave it alone unless you have a reason. - input1 β¦ input6 - all optional, all any-type. Connect as many or as few as you have.
- batch - the output: your inputs joined into one batch.
The joining logic adapts to what you feed it:
- Image/latent tensors get concatenated along the batch dimension. If dimensions differ, the smaller ones are upscaled to match the first input's dimensions - hence the resampling method.
- Strings, ints, floats get collected into a tuple.
- Lists and tuples get flattened in.
The traps
Two things the description is explicit about, and both are worth taking seriously.
Output size follows the first image. When batching images of different sizes, the final output matches the dimensions of whatever you plugged into the first populated input, and everything else is rescaled to fit. Order matters - put your preferred resolution first.
Don't mix types in one node. Batching a string and an image together "may have unexpected behavior." The node is dynamic, but it's not magic. Keep one FallbackAnyBatch for images, another for primitives, and you'll be fine.
Also note: if every input is missing, the node returns None rather than erroring. That's a feature for conditional workflows (the output slot just goes dark), but it also means whatever consumes the batch must tolerate a None on that iteration - which is why this node pairs so well with this pack's FallbackImagePreviewer, which turns missing images into a placeholder instead of dying.
Install
FallbackAnyBatch ships in VykosX/ControlFlowUtils:
# ComfyUI Manager β Install Custom Nodes β search "ControlFlowUtils"
# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/VykosX/ControlFlowUtils
Restart, find it under πΊ VykosX-ControlFlowUtils, and drop it where a batch feeds your sampler or previewer inside a loop. No dependencies, no model files - it's pure logic over whatever data you throw at it.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| method_for_images | COMBO | lanczos | Image scaling algorithm to use when creating image batches |
| input1opt | * | Data to join into a batch. May be a tensor, list, tuple or primitive | |
| input2opt | * | Data to join into a batch. May be a tensor, list, tuple or primitive | |
| input3opt | * | Data to join into a batch. May be a tensor, list, tuple or primitive | |
| input4opt | * | Data to join into a batch. May be a tensor, list, tuple or primitive | |
| input5opt | * | Data to join into a batch. May be a tensor, list, tuple or primitive | |
| input6opt | * | Data to join into a batch. May be a tensor, list, tuple or primitive |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| batch | * | Batch created by joining all the Inputs |