Comfy-Org/ComfyUI · error · ValueError

Only one input image is supported.

Error message

Only one input image is supported.

What it means

Thrown by the Grok image-to-video node when the optional image input contains a batch whose size is not exactly 1. The xAI video generations API accepts at most a single base64-encoded PNG as the image-to-video seed, so the node validates the batch count via get_number_of_images before building the request. Any batched tensor (e.g. from a node that outputs multiple images) triggers this.

Source

Thrown at comfy_api_nodes/nodes_grok.py:727

        )

    @classmethod
    async def execute(
        cls,
        model: str,
        prompt: str,
        resolution: str,
        aspect_ratio: str,
        duration: int,
        seed: int,
        image: Input.Image | None = None,
    ) -> IO.NodeOutput:
        if resolution == "1080p" and model != "grok-imagine-video-1.5":
            raise ValueError(f"1080p resolution is only available for grok-imagine-video-1.5, not '{model}'.")
        image_url = None
        if image is not None:
            if get_number_of_images(image) != 1:
                raise ValueError("Only one input image is supported.")
            image_url = InputUrlObject(url=f"data:image/png;base64,{tensor_to_base64_string(image)}")
        if image is None or model != "grok-imagine-video-1.5":
            validate_string(prompt, strip_whitespace=True, min_length=1)
        initial_response = await sync_op(
            cls,
            ApiEndpoint(path="/proxy/xai/v1/videos/generations", method="POST"),
            data=VideoGenerationRequest(
                model=_GROK_VIDEO_MODEL_API_IDS.get(model, model),
                image=image_url,
                prompt=prompt,
                resolution=resolution,
                duration=duration,
                aspect_ratio=None if aspect_ratio == "auto" else aspect_ratio,
                seed=seed,
            ),
            response_model=VideoGenerationResponse,
        )
        response = await poll_op(

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Select a single image before the node (e.g. use ImageBatchToImageList + a selector, or set Load Image to load only one frame)
  2. If using Load Image with an animated file, clear the batch so only one frame is loaded
  3. Split the batch and iterate, calling the node once per image

Example fix

// before: image input receives a batch of 4
// after: pick one item from the batch before connecting
from comfy_api_nodes.utils import tensor_to_base64_string  # node validates batch==1
# In the workflow: Load Image (batch=4) -> ImageBatchToImageList -> ImageSelector(index=0) -> Grok image input
Defensive patterns

Strategy: validation

Validate before calling

from comfy_api_nodes.utils import get_number_of_images

def single_image_ok(image) -> bool:
    return get_number_of_images(image) == 1

# before wiring the Grok video node:
assert single_image_ok(image), 'feed exactly one image'

Try / catch

try:
    out = await node.execute(...)
except ValueError as e:
    if 'Only one input image' in str(e):
        # split batch and loop per image
        ...

Prevention

When it happens

Trigger: Calling Grok Imagine Video generation with the optional image input connected to a source that emits a multi-image batch (Load Image batch, grid splitter, or any node whose output tensor has batch dim > 1).

Common situations: User loads a multi-frame image (GIF/APNG) with 'Load Image' which produces a batch; or connects an upstream node that returns several candidate images and forgets to pick one.

Related errors


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