calesthio/OpenMontage · error · ValueError

size must be one of: {', '.join(sorted(allowed))} for model

Error message

size must be one of: {', '.join(sorted(allowed))} for model {model}

What it means

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'.

Source

Thrown at tools/video/sora_video.py:248

            parts.append(int(digits or "0"))
        while len(parts) < 3:
            parts.append(0)
        return tuple(parts)

    @staticmethod
    def _normalize_model(inputs: dict[str, Any]) -> str:
        model = str(inputs.get("model", _DEFAULT_MODEL)).strip().lower()
        if model not in _ALLOWED_MODELS:
            raise ValueError("model must be one of: sora-2, sora-2-pro")
        return model

    @staticmethod
    def _normalize_size(inputs: dict[str, Any], model: str) -> str:
        default_size = "1280x720" if inputs.get("aspect_ratio") == "16:9" else _DEFAULT_SIZE
        size = str(inputs.get("size", default_size)).strip().lower()
        allowed = {"1280x720", "720x1280"} if model == "sora-2" else set(_ALLOWED_SIZES)
        if size not in allowed:
            raise ValueError(f"size must be one of: {', '.join(sorted(allowed))} for model {model}")
        return size

    @staticmethod
    def _normalize_seconds(inputs: dict[str, Any]) -> str:
        seconds = str(inputs.get("seconds") or inputs.get("duration") or _DEFAULT_SECONDS).strip().lower()
        seconds = seconds[:-1] if seconds.endswith("s") else seconds
        if seconds not in _ALLOWED_SECONDS:
            raise ValueError("seconds must be one of: 4, 8, 12")
        return seconds

    @staticmethod
    def _get_status_value(video: Any) -> str:
        if isinstance(video, dict):
            return str(video.get("status") or video.get("state") or "unknown")
        return str(getattr(video, "status", None) or getattr(video, "state", None) or "unknown")

    @staticmethod
    def _get_video_id(video: Any) -> str | None:

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. For sora-2, use 1280x720 or 720x1280 only.
  2. If you need higher resolutions, set model='sora-2-pro' first, then choose from its allowed sizes.
  3. Omit size and let the default (1280x720, aspect-aware) apply.

Example fix

# before
inputs = {"model": "sora-2", "size": "1920x1080"}

# after
inputs = {"model": "sora-2-pro", "size": "1920x1080"}
Defensive patterns

Strategy: validation

Validate before calling

model = str(inputs.get("model", "sora-2")).strip().lower()
allowed = {"1280x720", "720x1280"} if model == "sora-2" else set(_ALLOWED_SIZES)
size = str(inputs.get("size", "1280x720")).strip().lower()
if size not in allowed:
    inputs["size"] = "1280x720"

Type guard

def is_valid_sora_size(size: str, model: str) -> bool:
    allowed = {"1280x720", "720x1280"} if model == "sora-2" else set(_ALLOWED_SIZES)
    return str(size).strip().lower() in allowed

Prevention

When it happens

Trigger: 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.

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

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/527e5277405398ec. Report an issue: GitHub.