Comfy-Org/ComfyUI · error · ValueError

The current maximum number of supported images is 9.

Error message

The current maximum number of supported images is 9.

What it means

The FLUX 2.5 Pro image node hard-codes an upstream BFL limit of 9 reference images per request. The check uses get_number_of_images, which counts frames inside batched image tensors, not the number of connected inputs.

Source

Thrown at comfy_api_nodes/nodes_bfl.py:787

                expr=cls.PRICE_BADGE_EXPR,
            ),
            is_deprecated=True,
        )

    @classmethod
    async def execute(
        cls,
        prompt: str,
        width: int,
        height: int,
        seed: int,
        prompt_upsampling: bool,
        images: Input.Image | None = None,
    ) -> IO.NodeOutput:
        reference_images = {}
        if images is not None:
            if get_number_of_images(images) > 9:
                raise ValueError("The current maximum number of supported images is 9.")
            for image_index in range(images.shape[0]):
                key_name = f"input_image_{image_index + 1}" if image_index else "input_image"
                reference_images[key_name] = tensor_to_base64_string(images[image_index], total_pixels=2048 * 2048)
        initial_response = await sync_op(
            cls,
            ApiEndpoint(path=cls.API_ENDPOINT, method="POST"),
            response_model=BFLFluxProGenerateResponse,
            data=Flux2ProGenerateRequest(
                prompt=prompt,
                width=width,
                height=height,
                seed=seed,
                prompt_upsampling=prompt_upsampling,
                **reference_images,
            ),
        )

        def price_extractor(_r: BaseModel) -> float | None:

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Slice the batch to at most 9 images: images[:9].
  2. Split the work into multiple requests with <=9 images each.
  3. Select only the needed reference frames instead of wiring the whole batch.

Example fix

# before
images = extract_frames(video)      # e.g. 24 frames -> ValueError

# after
images = extract_frames(video)[:9]
Defensive patterns

Strategy: validation

Validate before calling

if images is not None:
    assert get_number_of_images(images) <= 9, "FLUX 2.5 Pro accepts max 9 reference images"

Type guard

def flux25_refs_ok(images) -> bool:
    return images is None or get_number_of_images(images) <= 9

Prevention

When it happens

Trigger: Calling the FLUX 2.5 Pro node with an images tensor whose batch dimension exceeds 9.

Common situations: Connecting a batch of reference frames or an image grid where each frame counts toward the limit; upstream nodes that output image batches by default.

Related errors


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