{"record":{"id":"c6de88df4be19d21","repo":"Comfy-Org/ComfyUI","slug":"invalid-size-for-sora-2-model-only-720x1280-and-1","errorCode":null,"errorMessage":"Invalid size for sora-2 model, only 720x1280 and 1280x720 are supported.","messagePattern":"Invalid size for sora-2 model, only 720x1280 and 1280x720 are supported\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_sora.py","lineNumber":127,"sourceCode":"                    ($isProSize ? 0.5 : 0.1);\n                  {\"type\":\"usd\",\"usd\": $round($perSec * $dur, 2)}\n                )\n                \"\"\",\n            ),\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        )","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_sora.py#L109-L145","documentation":"Raised by the Sora-2 node when model is \"sora-2\" and the size parameter is not one of the two supported resolutions (720x1280 portrait or 1280x720 landscape). Other models in the node skip this check. It fires before any request is sent to the OpenAI proxy endpoint.","triggerScenarios":"Calling the Sora node with model=\"sora-2\" and size set to anything else (e.g. \"1920x1080\", \"1024x1024\", or a typo like \"1280x720 \").","commonSituations":"Copying size settings from other video nodes that accept arbitrary resolutions; assuming sora-2 supports square or 1080p output; string formatting mistakes (extra spaces, uppercase X).","solutions":["Set size to exactly \"720x1280\" or \"1280x720\"","Pick the orientation matching your content: 720x1280 for vertical, 1280x720 for horizontal"],"exampleFix":"# before\ngenerate(model=\"sora-2\", size=\"1920x1080\", ...)\n\n# after\ngenerate(model=\"sora-2\", size=\"1280x720\", ...)","handlingStrategy":"validation","validationCode":"SORA2_SIZES = {\"720x1280\", \"1280x720\"}\nif model == \"sora-2\":\n    assert size in SORA2_SIZES, f\"sora-2 size must be one of {SORA2_SIZES}, got {size!r}\"","typeGuard":"def is_valid_sora2_size(model: str, size: str) -> bool:\n    return model != \"sora-2\" or size in (\"720x1280\", \"1280x720\")","tryCatchPattern":"try:\n    await sora_execute(model=\"sora-2\", size=size, ...)\nexcept ValueError as e:\n    if \"Invalid size\" in str(e):\n        await sora_execute(model=\"sora-2\", size=\"1280x720\", ...)\n    else:\n        raise","preventionTips":["Hard-code the two allowed sora-2 sizes in workflow templates","Choose orientation from your input image's aspect ratio before calling"],"tags":["sora","validation","resolution","openai"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}