Comfy-Org/ComfyUI · error · ValueError

Rodin Gen-2.5 accepts at most 5 images; received {len(flat_i

Error message

Rodin Gen-2.5 accepts at most 5 images; received {len(flat_images)}.

What it means

Raised by the Rodin Gen-2.5 Image-to-3D node when the flattened input image list exceeds the API's hard limit of 5 images. Multi-image tensors are flattened frame-by-frame (a 4D tensor of shape [N,C,H,W] becomes N separate images), so a batch of 6+ frames triggers it even if only one tensor was connected. It is a pre-flight client-side check before _build_request is called.

Source

Thrown at comfy_api_nodes/nodes_rodin.py:1004

        bbox_height: int,
        bbox_length: int,
        height_cm: int,
    ) -> IO.NodeOutput:
        image_tensors = [img for img in images.values() if img is not None]
        if not image_tensors:
            raise ValueError("Rodin Gen-2.5 Image-to-3D requires at least one image.")

        # Flatten multi-image tensors into individual frames; the API accepts each as a separate part.
        flat_images: list = []
        for tensor in image_tensors:
            if hasattr(tensor, "shape") and len(tensor.shape) == 4:
                for i in range(tensor.shape[0]):
                    flat_images.append(tensor[i])
            else:
                flat_images.append(tensor)

        if len(flat_images) > 5:
            raise ValueError(f"Rodin Gen-2.5 accepts at most 5 images; received {len(flat_images)}.")

        request = _build_request(
            mode_input=mode,
            material=material,
            geometry_file_format=geometry_file_format,
            texture_mode=texture_mode,
            seed=seed,
            TAPose=TAPose,
            hd_texture=hd_texture,
            texture_delight=texture_delight,
            addon_highpack=addon_highpack,
            bbox_width=bbox_width,
            bbox_height=bbox_height,
            bbox_length=bbox_length,
            height_cm=height_cm,
            prompt=None,
            use_original_alpha=use_original_alpha,
        )

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Reduce the input to at most 5 images (e.g. slice the batch: image[:5]) before connecting it
  2. If feeding a 4D tensor, remember each frame counts as one image; select only the key views you need
  3. Use an image batching/selection node upstream to pick specific frames

Example fix

// before
rodin_node(images=batch_tensor)  # batch_tensor.shape[0] == 8

// after
rodin_node(images=batch_tensor[:5])  # at most 5 frames
Defensive patterns

Strategy: validation

Validate before calling

def flatten_image_count(tensors) -> int:
    count = 0
    for t in tensors:
        if hasattr(t, "shape") and len(t.shape) == 4:
            count += t.shape[0]
        else:
            count += 1
    return count

assert flatten_image_count(image_tensors) <= 5, "Rodin Gen-2.5: max 5 images"

Type guard

def is_valid_rodin_image_set(tensors: list) -> bool:
    return flatten_image_count(tensors) <= 5

Try / catch

try:
    await rodin_gen25_execute(...)
except ValueError as e:
    if "at most 5 images" in str(e):
        images = images[:5]  # or surface to user
    else:
        raise

Prevention

When it happens

Trigger: Connecting an image batch/latent-decoded tensor with shape[0] > 5 to the Rodin Gen-2.5 node, or connecting 6+ individual image links; flattening logic at nodes_rodin.py:1004 counts every frame of every 4D tensor.

Common situations: Feeding an animated sequence or multi-view capture set into the image-to-3D node; assuming the node accepts one batched tensor of any size; iterating frames from a video for multi-angle reconstruction.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/c6e10deee6e82deb. Report an issue: GitHub.