{"record":{"id":"b6ed035247827f5d","repo":"calesthio/OpenMontage","slug":"reference-video-durations-must-match-the-number-of","errorCode":null,"errorMessage":"reference_video_durations must match the number of reference videos","messagePattern":"reference_video_durations must match the number of reference videos","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/seedance_ark.py","lineNumber":788,"sourceCode":"            max_audios = 10 if variant == \"2.5\" else 3\n            max_reference_seconds = 30 if variant == \"2.5\" else 15\n            if len(image_refs) > max_images:\n                raise ValueError(\n                    f\"reference_to_video accepts at most {max_images} reference images\"\n                )\n\n            video_refs = list(inputs.get(\"reference_video_urls\") or [])\n            if inputs.get(\"reference_video_url\"):\n                video_refs.append(inputs[\"reference_video_url\"])\n            if len(video_refs) > max_videos:\n                raise ValueError(\n                    f\"reference_to_video accepts at most {max_videos} reference videos\"\n                )\n            self._validate_remote_refs(video_refs, \"reference video\")\n            video_durations = list(inputs.get(\"reference_video_durations\") or [])\n            if video_durations:\n                if len(video_durations) != len(video_refs):\n                    raise ValueError(\n                        \"reference_video_durations must match the number of \"\n                        \"reference videos\"\n                    )\n                if any(\n                    float(value) < 2 or float(value) > max_reference_seconds\n                    for value in video_durations\n                ):\n                    raise ValueError(\n                        f\"each reference video duration must be 2 to {max_reference_seconds} seconds\"\n                    )\n                if (\n                    sum(float(value) for value in video_durations)\n                    > max_reference_seconds\n                ):\n                    raise ValueError(\n                        \"all reference videos together must be at most \"\n                        f\"{max_reference_seconds} seconds\"\n                    )","sourceCodeStart":770,"sourceCodeEnd":806,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/seedance_ark.py#L770-L806","documentation":"Raised when reference_video_durations is provided but its length differs from the number of video references. Durations are per-video hints used for validation and trimming, so they must be a parallel array to reference_video_urls.","triggerScenarios":"len(reference_video_durations) != len(reference_video_urls) (counting the singular reference_video_url) while the durations list is non-empty.","commonSituations":"Adding or removing a video ref without updating the durations array; reusing a durations list across different requests; including a duration for the singular reference_video_url but forgetting it in the count.","solutions":["Regenerate reference_video_durations so it has exactly one entry per video ref, in the same order","Omit reference_video_durations entirely if you cannot measure clip lengths"],"exampleFix":"# before\ninputs = {\"reference_video_urls\": [v1, v2, v3],\n          \"reference_video_durations\": [5, 5]}\n\n# after\ninputs = {\"reference_video_urls\": [v1, v2, v3],\n          \"reference_video_durations\": [5, 5, 5]}","handlingStrategy":"validation","validationCode":"durs = list(inputs.get(\"reference_video_durations\") or [])\nif durs and len(durs) != len(video_refs):\n    inputs[\"reference_video_durations\"] = []  # or rebuild per-clip via ffprobe\n    # better: probe each ref\n    # inputs[\"reference_video_durations\"] = [probe_duration(u) for u in video_refs]","typeGuard":"def durations_match(durations: list, refs: list) -> bool:\n    return not durations or len(durations) == len(refs)","tryCatchPattern":null,"preventionTips":["Generate durations programmatically from the ref list, never hand-maintain them","Drop the durations hint when unsure; local media is probed anyway"],"tags":["validation","seedance","ark","reference-to-video","durations"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}