{"record":{"id":"8c49371667e3b74a","repo":"calesthio/OpenMontage","slug":"reference-audio-durations-must-match-the-number-of","errorCode":null,"errorMessage":"reference_audio_durations must match the number of reference audio clips","messagePattern":"reference_audio_durations must match the number of reference audio clips","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/seedance_ark.py","lineNumber":822,"sourceCode":"                        \"all reference videos together must be at most \"\n                        f\"{max_reference_seconds} seconds\"\n                    )\n\n            audio_refs = list(inputs.get(\"reference_audio_urls\") or [])\n            audio_refs.extend(inputs.get(\"reference_audio_paths\") or [])\n            if inputs.get(\"reference_audio_url\"):\n                audio_refs.append(inputs[\"reference_audio_url\"])\n            if inputs.get(\"reference_audio_path\"):\n                audio_refs.append(inputs[\"reference_audio_path\"])\n            if len(audio_refs) > max_audios:\n                raise ValueError(\n                    \"reference_to_video accepts at most 3 reference audio \"\n                    f\"clips (maximum {max_audios})\"\n                )\n            audio_durations = list(inputs.get(\"reference_audio_durations\") or [])\n            if audio_durations:\n                if len(audio_durations) != len(audio_refs):\n                    raise ValueError(\n                        \"reference_audio_durations must match the number of \"\n                        \"reference audio clips\"\n                    )\n                if any(\n                    float(value) < 2 or float(value) > max_reference_seconds\n                    for value in audio_durations\n                ):\n                    raise ValueError(\n                        f\"each reference audio duration must be 2 to {max_reference_seconds} seconds\"\n                    )\n                if (\n                    sum(float(value) for value in audio_durations)\n                    > max_reference_seconds\n                ):\n                    raise ValueError(\n                        \"all reference audio clips together must be at most \"\n                        f\"{max_reference_seconds} seconds\"\n                    )","sourceCodeStart":804,"sourceCodeEnd":840,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/seedance_ark.py#L804-L840","documentation":"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.","triggerScenarios":"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.","commonSituations":"Appending an audio ref without appending a duration; sharing one durations array across requests with varying clip counts.","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"],"exampleFix":"# before\ninputs = {\"reference_audio_urls\": [a1, a2],\n          \"reference_audio_durations\": [4]}\n\n# after\ninputs = {\"reference_audio_urls\": [a1, a2],\n          \"reference_audio_durations\": [4, 4]}","handlingStrategy":"validation","validationCode":"durs = list(inputs.get(\"reference_audio_durations\") or [])\nif durs:\n    assert len(durs) == len(collected_audio_refs(inputs)), \"parallel arrays out of sync\"","typeGuard":"def audio_durations_match(durations: list, audio_refs: list) -> bool:\n    return not durations or len(durations) == len(audio_refs)","tryCatchPattern":null,"preventionTips":["Derive the durations list from the refs list in the same loop","Omit hints when you cannot keep them in sync"],"tags":["validation","seedance","ark","audio","durations"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}