{"record":{"id":"527e5277405398ec","repo":"calesthio/OpenMontage","slug":"size-must-be-one-of-join-sorted-allowed","errorCode":null,"errorMessage":"size must be one of: {', '.join(sorted(allowed))} for model {model}","messagePattern":"size must be one of: (.+?) for model (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/sora_video.py","lineNumber":248,"sourceCode":"            parts.append(int(digits or \"0\"))\n        while len(parts) < 3:\n            parts.append(0)\n        return tuple(parts)\n\n    @staticmethod\n    def _normalize_model(inputs: dict[str, Any]) -> str:\n        model = str(inputs.get(\"model\", _DEFAULT_MODEL)).strip().lower()\n        if model not in _ALLOWED_MODELS:\n            raise ValueError(\"model must be one of: sora-2, sora-2-pro\")\n        return model\n\n    @staticmethod\n    def _normalize_size(inputs: dict[str, Any], model: str) -> str:\n        default_size = \"1280x720\" if inputs.get(\"aspect_ratio\") == \"16:9\" else _DEFAULT_SIZE\n        size = str(inputs.get(\"size\", default_size)).strip().lower()\n        allowed = {\"1280x720\", \"720x1280\"} if model == \"sora-2\" else set(_ALLOWED_SIZES)\n        if size not in allowed:\n            raise ValueError(f\"size must be one of: {', '.join(sorted(allowed))} for model {model}\")\n        return size\n\n    @staticmethod\n    def _normalize_seconds(inputs: dict[str, Any]) -> str:\n        seconds = str(inputs.get(\"seconds\") or inputs.get(\"duration\") or _DEFAULT_SECONDS).strip().lower()\n        seconds = seconds[:-1] if seconds.endswith(\"s\") else seconds\n        if seconds not in _ALLOWED_SECONDS:\n            raise ValueError(\"seconds must be one of: 4, 8, 12\")\n        return seconds\n\n    @staticmethod\n    def _get_status_value(video: Any) -> str:\n        if isinstance(video, dict):\n            return str(video.get(\"status\") or video.get(\"state\") or \"unknown\")\n        return str(getattr(video, \"status\", None) or getattr(video, \"state\", None) or \"unknown\")\n\n    @staticmethod\n    def _get_video_id(video: Any) -> str | None:","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/sora_video.py#L230-L266","documentation":"ValueError raised by SoraVideo._normalize_size when the 'size' input is not in the allowed set for the chosen model. Base sora-2 only permits 1280x720 and 720x1280 (720p landscape/portrait), while sora-2-pro permits the wider _ALLOWED_SIZES set. The default is 1280x720, or driven by aspect_ratio == '16:9'.","triggerScenarios":"Requesting 1920x1080 or 1024x1792 style sizes on base sora-2; passing '1280X720' with a capital X (no — it is lowercased first, so that passes) — realistically: HD sizes on sora-2, portrait sizes like 720x1280 on models restricting them, or sizes from other providers' schemas.","commonSituations":"Upgrading prompts from sora-2 to pro-sized templates and forgetting to set model='sora-2-pro'; assuming 1080p exists because the pro model supports higher resolutions.","solutions":["For sora-2, use 1280x720 or 720x1280 only.","If you need higher resolutions, set model='sora-2-pro' first, then choose from its allowed sizes.","Omit size and let the default (1280x720, aspect-aware) apply."],"exampleFix":"# before\ninputs = {\"model\": \"sora-2\", \"size\": \"1920x1080\"}\n\n# after\ninputs = {\"model\": \"sora-2-pro\", \"size\": \"1920x1080\"}","handlingStrategy":"validation","validationCode":"model = str(inputs.get(\"model\", \"sora-2\")).strip().lower()\nallowed = {\"1280x720\", \"720x1280\"} if model == \"sora-2\" else set(_ALLOWED_SIZES)\nsize = str(inputs.get(\"size\", \"1280x720\")).strip().lower()\nif size not in allowed:\n    inputs[\"size\"] = \"1280x720\"","typeGuard":"def is_valid_sora_size(size: str, model: str) -> bool:\n    allowed = {\"1280x720\", \"720x1280\"} if model == \"sora-2\" else set(_ALLOWED_SIZES)\n    return str(size).strip().lower() in allowed","tryCatchPattern":null,"preventionTips":["Validate size jointly with model — the allowed set depends on it.","When upgrading to pro-tier sizes, set model first in the same change."],"tags":["validation","sora","resolution","model-selection"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}