Comfy-Org/ComfyUI · error · ValueError

Maximum of {max_num_of_images} reference images are supporte

Error message

Maximum of {max_num_of_images} reference images are supported, but {n_input_images} received.

What it means

Seedream caps reference (input) images: 14 for model id 'seedream-5-0-260128', 10 for all others. get_number_of_images counts the input batch, and exceeding the cap raises before any upload begins.

Source

Thrown at comfy_api_nodes/nodes_bytedance.py:723

        if ("seedream-4-5" in model or "seedream-5-0" in model) and out_num_pixels < 3686400:
            raise ValueError(
                f"Minimum image resolution for the selected model is 3.68MP, " f"but {mp_provided:.2f}MP provided."
            )
        if "seedream-4-0" in model and out_num_pixels < 921600:
            raise ValueError(
                f"Minimum image resolution that the selected model can generate is 0.92MP, "
                f"but {mp_provided:.2f}MP provided."
            )
        max_pixels = 10_404_496 if "seedream-5-0" in model else 16_777_216
        if out_num_pixels > max_pixels:
            raise ValueError(
                f"Maximum image resolution for the selected model is {max_pixels / 1_000_000:.2f}MP, "
                f"but {mp_provided:.2f}MP provided."
            )
        n_input_images = get_number_of_images(image) if image is not None else 0
        max_num_of_images = 14 if model == "seedream-5-0-260128" else 10
        if n_input_images > max_num_of_images:
            raise ValueError(
                f"Maximum of {max_num_of_images} reference images are supported, but {n_input_images} received."
            )
        if sequential_image_generation == "auto" and n_input_images + max_images > 15:
            raise ValueError(
                "The maximum number of generated images plus the number of reference images cannot exceed 15."
            )
        reference_images_urls = []
        if n_input_images:
            for i in image:
                validate_image_aspect_ratio(i, (1, 3), (3, 1))
            reference_images_urls = await upload_images_to_comfyapi(
                cls,
                image,
                max_images=n_input_images,
                mime_type="image/png",
            )
        response = await sync_op(
            cls,

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Trim the reference batch to at most 10 images (or 14 on seedream-5-0-260128).
  2. Split into multiple generations if all references matter.
  3. Curate references - Seedream quality typically degrades with near-cap counts anyway.
Defensive patterns

Strategy: validation

Validate before calling

cap = 14 if model == 'seedream-5-0-260128' else 10
if len(reference_images) > cap:
    reference_images = reference_images[:cap]

Prevention

When it happens

Trigger: The image input batch contains more images than max_num_of_images for the selected model - e.g. 12 reference images on a non-260128 model.

Common situations: Batch of reference/character images wired via an image batch node; model switched from seedream-5-0-260128 (14) to another variant (10) leaving an oversized batch.

Related errors


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