calesthio/OpenMontage · error · ValueError

aspect_ratio must be adaptive, 21:9, 16:9, 4:3, 1:1, 3:4, or

Error message

aspect_ratio must be adaptive, 21:9, 16:9, 4:3, 1:1, 3:4, or 9:16

What it means

Aspect-ratio gate in `_build_payload`: `aspect_ratio` (default '16:9') must be one of adaptive, 21:9, 16:9, 4:3, 1:1, 3:4, or 9:16 — the ratios Ark's video API accepts. 'adaptive' lets the provider infer the ratio from reference images. Any other string (or a malformed ratio like '16:9:9') is rejected before payload assembly.

Source

Thrown at tools/video/seedance_ark.py:719

            raise ValueError("resolution must be 480p, 720p, 1080p, or 4k")
        if variant in {"2.5", "fast", "mini"} and resolution not in {
            "480p",
            "720p",
        }:
            raise ValueError(f"{variant} supports only 480p or 720p resolution")

        ratio = str(inputs.get("aspect_ratio", "16:9"))
        valid_ratios = {
            "adaptive",
            "21:9",
            "16:9",
            "4:3",
            "1:1",
            "3:4",
            "9:16",
        }
        if ratio not in valid_ratios:
            raise ValueError(
                "aspect_ratio must be adaptive, 21:9, 16:9, 4:3, 1:1, 3:4, or 9:16"
            )

        max_duration = 30 if variant == "2.5" else 15
        duration = self._normalize_duration(inputs.get("duration", 5), max_duration)
        prompt = str(inputs.get("prompt") or "").strip()
        content: list[dict[str, Any]] = []
        if prompt:
            content.append({"type": "text", "text": prompt})

        if inputs.get("reference_video_path"):
            raise ValueError(
                "reference_video_path is not supported by Ark; upload the "
                "video to a public/signed HTTPS URL or Ark asset first"
            )

        if operation == "text_to_video":
            if not prompt:

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Use one of the seven exact tokens; colon separator, lowercase
  2. For portrait video choose '9:16' (not '16:9'), for tall-narrow choose '3:4'
  3. For image-to-video with a reference, 'adaptive' matches the source image

Example fix

# before
inputs = {"aspect_ratio": "9x16", "prompt": "..."}
# after
inputs = {"aspect_ratio": "9:16", "prompt": "..."}
Defensive patterns

Strategy: validation

Validate before calling

VALID_RATIOS = {"adaptive", "21:9", "16:9", "4:3", "1:1", "3:4", "9:16"}
ratio = str(inputs.get("aspect_ratio", "16:9"))
if ratio not in VALID_RATIOS:
    raise ValueError(f"aspect_ratio {ratio!r} not in {sorted(VALID_RATIOS)}")

Type guard

def is_valid_aspect_ratio(r: object) -> bool:
    return str(r) in {"adaptive", "21:9", "16:9", "4:3", "1:1", "3:4", "9:16"}

Prevention

When it happens

Trigger: Passing `aspect_ratio: '16-9'` (dash), `'vertical'`, `'9x16'` (x instead of colon), `'4:5'`, or wrong-case 'ADAPTIVE'; copying a social-platform spec token like '9:16.0'.

Common situations: Social-media presets using non-Ark vocabulary; region-specific ratios (4:5 Instagram) that Ark does not offer; format confusion between 'W:H' and 'H:W' — 3:4 is portrait-tall while 4:3 is landscape, and mixing them up does not error but gives the wrong orientation.

Related errors


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