Comfy-Org/ComfyUI · error · ValueError

Currently only one input image is supported.

Error message

Currently only one input image is supported.

What it means

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.

Source

Thrown at comfy_api_nodes/nodes_sora.py:131

            ),
        )

    @classmethod
    async def execute(
        cls,
        model: str,
        prompt: str,
        size: str = "1280x720",
        duration: int = 8,
        seed: int = 0,
        image: Optional[torch.Tensor] = None,
    ):
        if model == "sora-2" and size not in ("720x1280", "1280x720"):
            raise ValueError("Invalid size for sora-2 model, only 720x1280 and 1280x720 are supported.")
        files_input = None
        if image is not None:
            if get_number_of_images(image) != 1:
                raise ValueError("Currently only one input image is supported.")
            files_input = {"input_reference": ("image.png", tensor_to_bytesio(image), "image/png")}
        initial_response = await sync_op(
            cls,
            endpoint=ApiEndpoint(path="/proxy/openai/v1/videos", method="POST"),
            data=Sora2GenerationRequest(
                model=model,
                prompt=prompt,
                seconds=str(duration),
                size=size,
            ),
            files=files_input,
            response_model=Sora2GenerationResponse,
            content_type="multipart/form-data",
        )
        if initial_response.error:
            raise Exception(initial_response.error["message"])

        model_time_multiplier = 1 if model == "sora-2" else 2

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Select a single frame from the batch before connecting (slice index 0 or the desired frame)
  2. Use an image-selection/pick-frame node upstream

Example fix

# before
sora_generate(prompt, image=batch_tensor)  # shape[0] == 4

# after
sora_generate(prompt, image=batch_tensor[0:1])  # single image
Defensive patterns

Strategy: validation

Validate before calling

if image is not None:
    assert get_number_of_images(image) == 1, "Sora image input must be a single image, not a batch"

Type guard

def is_single_image(image) -> bool:
    return image is None or get_number_of_images(image) == 1

Try / catch

try:
    await sora_execute(prompt, image=image, ...)
except ValueError as e:
    if "only one input image" in str(e):
        await sora_execute(prompt, image=image[0:1], ...)
    else:
        raise

Prevention

When it happens

Trigger: Connecting a batched image tensor (shape[0] > 1) to the node's image input while doing image-to-video generation.

Common situations: 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.

Related errors


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