calesthio/OpenMontage · error · ValueError

each reference video duration must be 2 to {max_reference_se

Error message

each reference video duration must be 2 to {max_reference_seconds} seconds

What it means

Raised when any value in reference_video_durations is below 2 seconds or above the model's per-reference cap (15s for standard/fast/mini, 30s for 2.5). Ark cannot trim a reference video outside this window, so the builder rejects it before upload.

Source

Thrown at tools/video/seedance_ark.py:796

            if inputs.get("reference_video_url"):
                video_refs.append(inputs["reference_video_url"])
            if len(video_refs) > max_videos:
                raise ValueError(
                    f"reference_to_video accepts at most {max_videos} reference videos"
                )
            self._validate_remote_refs(video_refs, "reference video")
            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:

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Set each entry in reference_video_durations to a value between 2 and 15 (or 30 with model_variant='2.5')
  2. Trim the source clips to the window you actually want referenced
  3. Use model_variant='2.5' if references longer than 15s are required

Example fix

# before
inputs = {"reference_video_durations": [1.5, 20]}  # standard variant

# after
inputs = {"reference_video_durations": [2, 15]}
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Prevention

When it happens

Trigger: A reference_video_durations entry like 1, 0.5, 20 (non-2.5), or 45 (2.5).

Common situations: Assuming any clip length is acceptable; using the 2.5 limits (30s) against a standard-variant model; passing milliseconds (e.g. 5000) instead of seconds.

Related errors


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