calesthio/OpenMontage · error · ValueError
reference_audio_durations must match the number of reference
Error message
reference_audio_durations must match the number of reference audio clips
What it means
Raised when reference_audio_durations is non-empty and its length differs from the number of audio references. Like the video durations array, audio durations must be a parallel per-clip list matching the collected audio refs exactly.
Source
Thrown at tools/video/seedance_ark.py:822
"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):
raise ValueError(
"reference_audio_durations must match the number of "
"reference audio clips"
)
if any(
float(value) < 2 or float(value) > max_reference_seconds
for value in audio_durations
):
raise ValueError(
f"each reference audio duration must be 2 to {max_reference_seconds} seconds"
)
if (
sum(float(value) for value in audio_durations)
> max_reference_seconds
):
raise ValueError(
"all reference audio clips together must be at most "
f"{max_reference_seconds} seconds"
)View on GitHub (pinned to 95e1c3d0ab)
Solutions
- Rebuild reference_audio_durations with one entry per audio ref in the same order
- Drop reference_audio_durations if per-clip hints are unnecessary
Example fix
# before
inputs = {"reference_audio_urls": [a1, a2],
"reference_audio_durations": [4]}
# after
inputs = {"reference_audio_urls": [a1, a2],
"reference_audio_durations": [4, 4]} Defensive patterns
Strategy: validation
Validate before calling
durs = list(inputs.get("reference_audio_durations") or [])
if durs:
assert len(durs) == len(collected_audio_refs(inputs)), "parallel arrays out of sync" Type guard
def audio_durations_match(durations: list, audio_refs: list) -> bool:
return not durations or len(durations) == len(audio_refs) Prevention
- Derive the durations list from the refs list in the same loop
- Omit hints when you cannot keep them in sync
When it happens
Trigger: len(reference_audio_durations) != len(audio_refs), e.g. 3 durations for 4 clips, or forgetting the singular reference_audio_url contributes to the count.
Common situations: Appending an audio ref without appending a duration; sharing one durations array across requests with varying clip counts.
Related errors
- each reference audio duration must be 2 to {max_reference_se
- all reference audio clips together must be at most {max_refe
- all local reference audio clips together must be at most {ma
- reference_video_durations must match the number of reference
- each reference video duration must be 2 to {max_reference_se
AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15).
Data as JSON: /api/errors/8c49371667e3b74a.
Report an issue: GitHub.