{"record":{"id":"b9a7b2a0959b3571","repo":"calesthio/OpenMontage","slug":"reference-to-video-requires-at-least-one-image-or","errorCode":null,"errorMessage":"reference_to_video requires at least one image or video","messagePattern":"reference_to_video requires at least one image or video","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/seedance_ark.py","lineNumber":861,"sourceCode":"                for ref in audio_refs\n                if (\n                    duration := self._local_or_data_audio_duration(\n                        str(ref), max_seconds=max_reference_seconds\n                    )\n                )\n                is not None\n            ]\n            if sum(local_audio_durations) > max_reference_seconds:\n                raise ValueError(\n                    \"all local reference audio clips together must be at \"\n                    f\"most {max_reference_seconds} seconds\"\n                )\n            if audio_refs and not (image_refs or video_refs):\n                raise ValueError(\n                    \"reference audio requires at least one reference image or video\"\n                )\n            if not (image_refs or video_refs):\n                raise ValueError(\n                    \"reference_to_video requires at least one image or video\"\n                )\n\n            content.extend(\n                self._image_content(ref, role=\"reference_image\") for ref in image_refs\n            )\n            content.extend(\n                {\n                    \"type\": \"video_url\",\n                    \"video_url\": {\"url\": str(ref)},\n                    \"role\": \"reference_video\",\n                }\n                for ref in video_refs\n            )\n            content.extend(\n                self._audio_content(ref, role=\"reference_audio\") for ref in audio_refs\n            )\n","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/seedance_ark.py#L843-L879","documentation":"Raised in reference_to_video mode when neither image nor video references are present. The operation is defined by visual conditioning, so an empty reference set makes the request meaningless and is rejected before the API call (note this branch is also the default for any operation other than text_to_video/image_to_video).","triggerScenarios":"operation='reference_to_video' (or an unrecognized operation string) with all reference_image_* and reference_video_* keys empty.","commonSituations":"Defaulting operation to reference_to_video and forgetting refs; typo'ing the operation value (e.g. 'reference2video') so it falls into this branch; refs dropped by upstream null-filtering.","solutions":["Provide at least one image or video reference","Use text_to_video when no references are available","Check the operation string for typos, since unknown values fall into this branch"],"exampleFix":"# before\ninputs = {\"operation\": \"reference_to_video\", \"prompt\": p}\n\n# after\ninputs = {\"operation\": \"text_to_video\", \"prompt\": p}","handlingStrategy":"validation","validationCode":"if not (image_ref_list(inputs) or video_ref_list(inputs)):\n    if not inputs.get(\"prompt\"):\n        raise ValueError(\"nothing to generate from\")\n    inputs[\"operation\"] = \"text_to_video\"  # downgrade to prompt-only","typeGuard":"def operation_has_required_refs(inputs: dict) -> bool:\n    op = inputs.get(\"operation\")\n    if op == \"reference_to_video\":\n        return bool(image_ref_list(inputs) or video_ref_list(inputs))\n    return True","tryCatchPattern":null,"preventionTips":["Spell-check the operation value; unknown values fall into the reference branch","Assert refs are non-empty before reference_to_video calls"],"tags":["validation","seedance","ark","reference-to-video","input-validation"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}