{"record":{"id":"da9bfcf339777e02","repo":"Comfy-Org/ComfyUI","slug":"currently-only-one-input-image-is-supported-da9bfc","errorCode":null,"errorMessage":"Currently only one input image is supported.","messagePattern":"Currently only one input image is supported\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_sora.py","lineNumber":131,"sourceCode":"            ),\n        )\n\n    @classmethod\n    async def execute(\n        cls,\n        model: str,\n        prompt: str,\n        size: str = \"1280x720\",\n        duration: int = 8,\n        seed: int = 0,\n        image: Optional[torch.Tensor] = None,\n    ):\n        if model == \"sora-2\" and size not in (\"720x1280\", \"1280x720\"):\n            raise ValueError(\"Invalid size for sora-2 model, only 720x1280 and 1280x720 are supported.\")\n        files_input = None\n        if image is not None:\n            if get_number_of_images(image) != 1:\n                raise ValueError(\"Currently only one input image is supported.\")\n            files_input = {\"input_reference\": (\"image.png\", tensor_to_bytesio(image), \"image/png\")}\n        initial_response = await sync_op(\n            cls,\n            endpoint=ApiEndpoint(path=\"/proxy/openai/v1/videos\", method=\"POST\"),\n            data=Sora2GenerationRequest(\n                model=model,\n                prompt=prompt,\n                seconds=str(duration),\n                size=size,\n            ),\n            files=files_input,\n            response_model=Sora2GenerationResponse,\n            content_type=\"multipart/form-data\",\n        )\n        if initial_response.error:\n            raise Exception(initial_response.error[\"message\"])\n\n        model_time_multiplier = 1 if model == \"sora-2\" else 2","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_sora.py#L113-L149","documentation":"Raised by the Sora-2 node when an optional image input is provided whose batch contains more than one image. The OpenAI videos endpoint accepts a single input_reference file, so get_number_of_images(image) must equal 1. It fires before the multipart request is built.","triggerScenarios":"Connecting a batched image tensor (shape[0] > 1) to the node's image input while doing image-to-video generation.","commonSituations":"Feeding decoded video frames or a multi-image generation output directly; forgetting that LoadImage batches remain shape [N,C,H,W] after common preprocessing nodes.","solutions":["Select a single frame from the batch before connecting (slice index 0 or the desired frame)","Use an image-selection/pick-frame node upstream"],"exampleFix":"# before\nsora_generate(prompt, image=batch_tensor)  # shape[0] == 4\n\n# after\nsora_generate(prompt, image=batch_tensor[0:1])  # single image","handlingStrategy":"validation","validationCode":"if image is not None:\n    assert get_number_of_images(image) == 1, \"Sora image input must be a single image, not a batch\"","typeGuard":"def is_single_image(image) -> bool:\n    return image is None or get_number_of_images(image) == 1","tryCatchPattern":"try:\n    await sora_execute(prompt, image=image, ...)\nexcept ValueError as e:\n    if \"only one input image\" in str(e):\n        await sora_execute(prompt, image=image[0:1], ...)\n    else:\n        raise","preventionTips":["Slice batches to one frame before image-to-video nodes","Check shape[0] after any node that can expand batches (e.g. video-to-image decoders)"],"tags":["sora","image-batch","validation","image-to-video"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}