Comfy-Org/ComfyUI · error · ValueError

The pro model supports only 1 input image.

Error message

The pro model supports only 1 input image.

What it means

Grok image edit validation: the 'grok-imagine-image-pro' model accepts exactly one input image. get_number_of_images counts the batch dimension, so a single tensor containing 2+ images or multiple image inputs triggers this. The check is client-side, before the /proxy/xai/v1/images/edits request is built.

Source

Thrown at comfy_api_nodes/nodes_grok.py:445

            ),
            is_deprecated=True,
        )

    @classmethod
    async def execute(
        cls,
        model: str,
        image: Input.Image,
        prompt: str,
        resolution: str,
        number_of_images: int,
        seed: int,
        aspect_ratio: str = "auto",
    ) -> IO.NodeOutput:
        validate_string(prompt, strip_whitespace=True, min_length=1)
        if model == "grok-imagine-image-pro":
            if get_number_of_images(image) > 1:
                raise ValueError("The pro model supports only 1 input image.")
        elif get_number_of_images(image) > 3:
            raise ValueError("A maximum of 3 input images is supported.")
        if aspect_ratio != "auto" and get_number_of_images(image) == 1:
            raise ValueError(
                "Custom aspect ratio is only allowed when multiple images are connected to the image input."
            )
        response = await sync_op(
            cls,
            ApiEndpoint(path="/proxy/xai/v1/images/edits", method="POST"),
            data=ImageEditRequest(
                model=model,
                images=[InputUrlObject(url=f"data:image/png;base64,{tensor_to_base64_string(i)}") for i in image],
                prompt=prompt,
                resolution=resolution.lower(),
                n=number_of_images,
                seed=seed,
                aspect_ratio=None if aspect_ratio == "auto" else aspect_ratio,
            ),

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Select exactly one image: slice the batch (image[0]) or disconnect extra inputs.
  2. Switch to a non-pro grok model if you need up to 3 reference images.

Example fix

# before
await grok_image_edit(model='grok-imagine-image-pro', image=two_frame_batch)  # raises

# after
await grok_image_edit(model='grok-imagine-image-pro', image=two_frame_batch[0:1])
Defensive patterns

Strategy: validation

Validate before calling

if model == "grok-imagine-image-pro":
    assert get_number_of_images(image) <= 1, "pro model takes exactly 1 image"

Prevention

When it happens

Trigger: Calling the grok image edit execute with model='grok-imagine-image-pro' and an image input whose batch size > 1.

Common situations: Switching the model dropdown to pro while keeping a multi-image workflow wired for the standard model; feeding a batched tensor (e.g. video frames or a grid) instead of a single image.

Related errors


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