calesthio/OpenMontage · error · ValueError

all reference videos together must be at most {max_reference

Error message

all reference videos together must be at most {max_reference_seconds} seconds

What it means

Raised when the sum of reference_video_durations exceeds the model's total reference budget (15s standard variants, 30s for 2.5). Even if each clip is individually valid, Ark caps the combined referenced footage, and this client-side check enforces it before the request.

Source

Thrown at tools/video/seedance_ark.py:803

            video_durations = list(inputs.get("reference_video_durations") or [])
            if video_durations:
                if len(video_durations) != len(video_refs):
                    raise ValueError(
                        "reference_video_durations must match the number of "
                        "reference videos"
                    )
                if any(
                    float(value) < 2 or float(value) > max_reference_seconds
                    for value in video_durations
                ):
                    raise ValueError(
                        f"each reference video duration must be 2 to {max_reference_seconds} seconds"
                    )
                if (
                    sum(float(value) for value in video_durations)
                    > max_reference_seconds
                ):
                    raise ValueError(
                        "all reference videos together must be at most "
                        f"{max_reference_seconds} seconds"
                    )

            audio_refs = list(inputs.get("reference_audio_urls") or [])
            audio_refs.extend(inputs.get("reference_audio_paths") or [])
            if inputs.get("reference_audio_url"):
                audio_refs.append(inputs["reference_audio_url"])
            if inputs.get("reference_audio_path"):
                audio_refs.append(inputs["reference_audio_path"])
            if len(audio_refs) > max_audios:
                raise ValueError(
                    "reference_to_video accepts at most 3 reference audio "
                    f"clips (maximum {max_audios})"
                )
            audio_durations = list(inputs.get("reference_audio_durations") or [])
            if audio_durations:
                if len(audio_durations) != len(audio_refs):

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Lower durations or drop clips until the sum is at most 15 (or 30 on 2.5)
  2. Concatenate and trim source footage into fewer, shorter references
  3. Switch to model_variant='2.5' for the larger 30-second budget

Example fix

# before
inputs = {"reference_video_durations": [6, 6, 6]}  # 18s > 15s

# after
inputs = {"reference_video_durations": [5, 5, 5]}  # 15s ok
Defensive patterns

Strategy: validation

Validate before calling

max_s = 30 if str(inputs.get("model_variant", "standard")).lower() == "2.5" else 15
assert sum(float(d) for d in inputs.get("reference_video_durations") or []) <= max_s

Type guard

def within_total_video_budget(durations: list, max_s: int = 15) -> bool:
    return sum(float(d) for d in durations or []) <= max_s

Prevention

When it happens

Trigger: Three valid 6-second durations on the standard variant (18 > 15), or four 9-second durations on 2.5 (36 > 30).

Common situations: Maxing out both the per-clip and clip-count limits and forgetting they share one total budget; assuming per-clip compliance implies total compliance.

Related errors


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