Comfy-Org/ComfyUI · error · Exception

{message}

Error message

{message}

What it means

Raised by the Sora-2 node when the initial generation response carries an `error` field. The OpenAI proxy returns submission errors (auth, quota, invalid parameters, moderation) inline in the response body rather than via HTTP status, and the node re-raises the embedded message verbatim as a generic Exception.

Source

Thrown at comfy_api_nodes/nodes_sora.py:147

        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
        await poll_op(
            cls,
            poll_endpoint=ApiEndpoint(path=f"/proxy/openai/v1/videos/{initial_response.id}"),
            response_model=Sora2GenerationResponse,
            status_extractor=lambda x: x.status,
            poll_interval=8.0,
            estimated_duration=int(45 * (duration / 4) * model_time_multiplier),
        )
        return IO.NodeOutput(
            await download_url_to_video_output(f"/proxy/openai/v1/videos/{initial_response.id}/content", cls=cls),
        )


class OpenAISoraExtension(ComfyExtension):
    @override
    async def get_node_list(self) -> list[type[IO.ComfyNode]]:

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Read the embedded message: auth errors → fix API key, quota → top up billing, moderation → adjust prompt
  2. Verify the OpenAI API key configured for the ComfyUI proxy endpoint
  3. For parameter errors, check model-specific constraints (size, duration) before the prompt content
Defensive patterns

Strategy: try-catch

Validate before calling

import os
assert os.environ.get("OPENAI_API_KEY"), "OpenAI API key required for Sora nodes"

Try / catch

try:
    out = await sora_execute(...)
except Exception as e:
    msg = str(e)
    if "api key" in msg.lower() or "authentication" in msg.lower():
        fix_openai_credentials()
    elif "quota" in msg.lower() or "billing" in msg.lower():
        raise RuntimeError("OpenAI quota exhausted") from e
    else:
        raise

Prevention

When it happens

Trigger: POST to /proxy/openai/v1/videos returning a Sora2GenerationResponse with error set — invalid OpenAI/API key, insufficient credits, disallowed prompt content, or unsupported parameter combination.

Common situations: Missing or expired OpenAI API key configured for the proxy; account billing/quota exhausted; prompt triggering content moderation; using unsupported duration/size combos for the model.

Related errors


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