{"record":{"id":"847d49d377709664","repo":"Comfy-Org/ComfyUI","slug":"the-pro-model-supports-only-1-input-image","errorCode":null,"errorMessage":"The pro model supports only 1 input image.","messagePattern":"The pro model supports only 1 input image\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_grok.py","lineNumber":445,"sourceCode":"            ),\n            is_deprecated=True,\n        )\n\n    @classmethod\n    async def execute(\n        cls,\n        model: str,\n        image: Input.Image,\n        prompt: str,\n        resolution: str,\n        number_of_images: int,\n        seed: int,\n        aspect_ratio: str = \"auto\",\n    ) -> IO.NodeOutput:\n        validate_string(prompt, strip_whitespace=True, min_length=1)\n        if model == \"grok-imagine-image-pro\":\n            if get_number_of_images(image) > 1:\n                raise ValueError(\"The pro model supports only 1 input image.\")\n        elif get_number_of_images(image) > 3:\n            raise ValueError(\"A maximum of 3 input images is supported.\")\n        if aspect_ratio != \"auto\" and get_number_of_images(image) == 1:\n            raise ValueError(\n                \"Custom aspect ratio is only allowed when multiple images are connected to the image input.\"\n            )\n        response = await sync_op(\n            cls,\n            ApiEndpoint(path=\"/proxy/xai/v1/images/edits\", method=\"POST\"),\n            data=ImageEditRequest(\n                model=model,\n                images=[InputUrlObject(url=f\"data:image/png;base64,{tensor_to_base64_string(i)}\") for i in image],\n                prompt=prompt,\n                resolution=resolution.lower(),\n                n=number_of_images,\n                seed=seed,\n                aspect_ratio=None if aspect_ratio == \"auto\" else aspect_ratio,\n            ),","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_grok.py#L427-L463","documentation":"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.","triggerScenarios":"Calling the grok image edit execute with model='grok-imagine-image-pro' and an image input whose batch size > 1.","commonSituations":"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.","solutions":["Select exactly one image: slice the batch (image[0]) or disconnect extra inputs.","Switch to a non-pro grok model if you need up to 3 reference images."],"exampleFix":"# before\nawait grok_image_edit(model='grok-imagine-image-pro', image=two_frame_batch)  # raises\n\n# after\nawait grok_image_edit(model='grok-imagine-image-pro', image=two_frame_batch[0:1])","handlingStrategy":"validation","validationCode":"if model == \"grok-imagine-image-pro\":\n    assert get_number_of_images(image) <= 1, \"pro model takes exactly 1 image\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Trim inputs to a single image before selecting the pro model.","Slice batched tensors: image = image[0:1].","Switch to a standard model when multi-image reference is required."],"tags":["grok","xai","image-editing","input-validation","limit","comfy-api-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}