{"record":{"id":"a35eccce4c5e58e5","repo":"calesthio/OpenMontage","slug":"all-reference-videos-together-must-be-at-most-max","errorCode":null,"errorMessage":"all reference videos together must be at most {max_reference_seconds} seconds","messagePattern":"all reference videos together must be at most (.+?) seconds","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/seedance_ark.py","lineNumber":803,"sourceCode":"            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                    )\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):","sourceCodeStart":785,"sourceCodeEnd":821,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/seedance_ark.py#L785-L821","documentation":"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.","triggerScenarios":"Three valid 6-second durations on the standard variant (18 > 15), or four 9-second durations on 2.5 (36 > 30).","commonSituations":"Maxing out both the per-clip and clip-count limits and forgetting they share one total budget; assuming per-clip compliance implies total compliance.","solutions":["Lower durations or drop clips until the sum is at most 15 (or 30 on 2.5)","Concatenate and trim source footage into fewer, shorter references","Switch to model_variant='2.5' for the larger 30-second budget"],"exampleFix":"# before\ninputs = {\"reference_video_durations\": [6, 6, 6]}  # 18s > 15s\n\n# after\ninputs = {\"reference_video_durations\": [5, 5, 5]}  # 15s ok","handlingStrategy":"validation","validationCode":"max_s = 30 if str(inputs.get(\"model_variant\", \"standard\")).lower() == \"2.5\" else 15\nassert sum(float(d) for d in inputs.get(\"reference_video_durations\") or []) <= max_s","typeGuard":"def within_total_video_budget(durations: list, max_s: int = 15) -> bool:\n    return sum(float(d) for d in durations or []) <= max_s","tryCatchPattern":null,"preventionTips":["Budget total reference seconds, not just per-clip length","Shrink the largest clip first when over budget"],"tags":["validation","seedance","ark","durations","limits"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}