Comfy-Org/ComfyUI · error · ValueError

FLUX 3 supports at most {_FLUX3_MAX_IMAGES} {field_name}, go

Error message

FLUX 3 supports at most {_FLUX3_MAX_IMAGES} {field_name}, got {len(flat)}.

What it means

FLUX 3 accepts at most 10 images per field (keyframes or conditioning frames). _flux3_collect_images flattens every Autogrow slot (each possibly a 4D batch) into single images and raises if the total exceeds _FLUX3_MAX_IMAGES before validating dimensions.

Source

Thrown at comfy_api_nodes/nodes_bfl.py:1050

    if max(width, height) > _FLUX3_MAX_IMAGE_ASPECT * min(width, height):
        raise ValueError(
            f"Image aspect ratio is too extreme ({width}x{height}); "
            f"FLUX 3 accepts at most {_FLUX3_MAX_IMAGE_ASPECT}:1."
        )


def _flux3_collect_images(images: dict | None, field_name: str) -> list[torch.Tensor]:
    """Flatten Autogrow slots (each possibly batched) into single images and validate them."""
    flat: list[torch.Tensor] = []
    for tensor in (images or {}).values():
        if tensor is None:
            continue
        if tensor.ndim == 4:
            flat.extend(tensor[i] for i in range(tensor.shape[0]))
        else:
            flat.append(tensor)
    if len(flat) > _FLUX3_MAX_IMAGES:
        raise ValueError(f"FLUX 3 supports at most {_FLUX3_MAX_IMAGES} {field_name}, got {len(flat)}.")
    for tensor in flat:
        _flux3_validate_image(tensor)
    return flat


def _flux3_parse_times(value: str, image_count: int, duration: int | str) -> list[float]:
    """Parse one keyframe time in seconds per image: increasing, inside the clip."""
    parts = [part.strip() for part in value.split(",") if part.strip()]
    if len(parts) != image_count:
        raise ValueError(
            f"Give one time per keyframe image: got {len(parts)} time(s) for {image_count} image(s)."
        )
    try:
        times = [float(part) for part in parts]
    except ValueError as exc:
        raise ValueError(f"Keyframe times must be numbers in seconds, comma-separated; got '{value}'.") from exc
    if not all(math.isfinite(time) for time in times):
        raise ValueError(f"Keyframe times must be finite numbers in seconds; got '{value}'.")

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Keep the flattened total at or below 10 images.
  2. Select the most representative keyframes instead of wiring every frame.
  3. Split into sequential generations if more coverage is needed.

Example fix

# before
flat = flatten(image_slots)  # 14 images -> ValueError

# after
flat = flatten(image_slots)[:10]
Defensive patterns

Strategy: validation

Validate before calling

flat = [t for tensor in (images or {}).values() if tensor is not None
        for t in (list(tensor) if tensor.ndim == 4 else [tensor])]
assert len(flat) <= 10, f"FLUX 3 max 10 images, got {len(flat)}"

Type guard

def flux3_image_count_ok(images: dict | None) -> bool:
    n = 0
    for t in (images or {}).values():
        if t is None:
            continue
        n += t.shape[0] if t.ndim == 4 else 1
    return n <= 10

Prevention

When it happens

Trigger: Connecting Autogrow image inputs whose flattened frame total exceeds 10, e.g. three slots holding 4-frame batches.

Common situations: Assuming the limit is per-slot rather than global; connecting frame-sequence batches intended for other video models.

Related errors


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