{"record":{"id":"731f0bec11e68a86","repo":"Comfy-Org/ComfyUI","slug":"only-one-input-image-is-supported","errorCode":null,"errorMessage":"Only one input image is supported.","messagePattern":"Only one input image is supported\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_grok.py","lineNumber":727,"sourceCode":"        )\n\n    @classmethod\n    async def execute(\n        cls,\n        model: str,\n        prompt: str,\n        resolution: str,\n        aspect_ratio: str,\n        duration: int,\n        seed: int,\n        image: Input.Image | None = None,\n    ) -> IO.NodeOutput:\n        if resolution == \"1080p\" and model != \"grok-imagine-video-1.5\":\n            raise ValueError(f\"1080p resolution is only available for grok-imagine-video-1.5, not '{model}'.\")\n        image_url = None\n        if image is not None:\n            if get_number_of_images(image) != 1:\n                raise ValueError(\"Only one input image is supported.\")\n            image_url = InputUrlObject(url=f\"data:image/png;base64,{tensor_to_base64_string(image)}\")\n        if image is None or model != \"grok-imagine-video-1.5\":\n            validate_string(prompt, strip_whitespace=True, min_length=1)\n        initial_response = await sync_op(\n            cls,\n            ApiEndpoint(path=\"/proxy/xai/v1/videos/generations\", method=\"POST\"),\n            data=VideoGenerationRequest(\n                model=_GROK_VIDEO_MODEL_API_IDS.get(model, model),\n                image=image_url,\n                prompt=prompt,\n                resolution=resolution,\n                duration=duration,\n                aspect_ratio=None if aspect_ratio == \"auto\" else aspect_ratio,\n                seed=seed,\n            ),\n            response_model=VideoGenerationResponse,\n        )\n        response = await poll_op(","sourceCodeStart":709,"sourceCodeEnd":745,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_grok.py#L709-L745","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Select a single image before the node (e.g. use ImageBatchToImageList + a selector, or set Load Image to load only one frame)","If using Load Image with an animated file, clear the batch so only one frame is loaded","Split the batch and iterate, calling the node once per image"],"exampleFix":"// before: image input receives a batch of 4\n// after: pick one item from the batch before connecting\nfrom comfy_api_nodes.utils import tensor_to_base64_string  # node validates batch==1\n# In the workflow: Load Image (batch=4) -> ImageBatchToImageList -> ImageSelector(index=0) -> Grok image input","handlingStrategy":"validation","validationCode":"from comfy_api_nodes.utils import get_number_of_images\n\ndef single_image_ok(image) -> bool:\n    return get_number_of_images(image) == 1\n\n# before wiring the Grok video node:\nassert single_image_ok(image), 'feed exactly one image'","typeGuard":null,"tryCatchPattern":"try:\n    out = await node.execute(...)\nexcept ValueError as e:\n    if 'Only one input image' in str(e):\n        # split batch and loop per image\n        ...","preventionTips":["Always select a single frame after Load Image on GIF/APNG inputs","Keep a batch-to-list + selector pair in front of single-image API nodes"],"tags":["grok","xai","video-generation","input-validation","image-batch"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}