{"record":{"id":"620c2c4aa2e6cace","repo":"calesthio/OpenMontage","slug":"reference-to-video-accepts-at-most-max-images-re","errorCode":null,"errorMessage":"reference_to_video accepts at most {max_images} reference images","messagePattern":"reference_to_video accepts at most (.+?) reference images","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/seedance_ark.py","lineNumber":773,"sourceCode":"                if value\n            ]\n            if len(end_refs) > 1:\n                raise ValueError(\"provide only one of end_image_url/end_image_path\")\n            if end_refs:\n                content.append(self._image_content(end_refs[0], role=\"last_frame\"))\n        else:\n            image_refs = list(inputs.get(\"reference_image_urls\") or [])\n            image_refs.extend(inputs.get(\"reference_image_paths\") or [])\n            if inputs.get(\"reference_image_url\"):\n                image_refs.append(inputs[\"reference_image_url\"])\n            if inputs.get(\"reference_image_path\"):\n                image_refs.append(inputs[\"reference_image_path\"])\n            max_images = 30 if variant == \"2.5\" else 9\n            max_videos = 10 if variant == \"2.5\" else 3\n            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                    )","sourceCodeStart":755,"sourceCodeEnd":791,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/seedance_ark.py#L755-L791","documentation":"Raised in reference_to_video mode when the total number of image references (reference_image_urls + reference_image_paths + singular url/path keys) exceeds the model limit: 30 for variant 2.5, 9 otherwise. The builder enforces Ark's multimodal reference cap client-side.","triggerScenarios":"operation='reference_to_video' with more than 9 image refs on standard/fast/mini, or more than 30 on model_variant='2.5'.","commonSituations":"Feeding an entire storyboard or sprite sheet folder as individual refs; not realizing the cap depends on the model variant; mixing singular and plural image keys so the count silently grows.","solutions":["Trim reference_image_urls/paths to at most 9 (or 30 with model_variant='2.5')","Set model_variant='2.5' when you genuinely need 10-30 image refs","Composite multiple references into fewer images before sending"],"exampleFix":"# before\ninputs = {\"operation\": \"reference_to_video\", \"reference_image_urls\": storyboard_40}\n\n# after\nstoryboard = storyboard_40[:30]\ninputs = {\"operation\": \"reference_to_video\", \"model_variant\": \"2.5\",\n          \"reference_image_urls\": storyboard}","handlingStrategy":"validation","validationCode":"def image_ref_list(inputs):\n    refs = list(inputs.get(\"reference_image_urls\") or [])\n    refs += list(inputs.get(\"reference_image_paths\") or [])\n    if inputs.get(\"reference_image_url\"): refs.append(inputs[\"reference_image_url\"])\n    if inputs.get(\"reference_image_path\"): refs.append(inputs[\"reference_image_path\"])\n    return refs\n\nvariant = str(inputs.get(\"model_variant\", \"standard\")).lower()\nassert len(image_ref_list(inputs)) <= (30 if variant == \"2.5\" else 9)","typeGuard":"def within_image_limit(inputs: dict) -> bool:\n    return len(image_ref_list(inputs)) <= (30 if str(inputs.get(\"model_variant\", \"standard\")).lower() == \"2.5\" else 9)","tryCatchPattern":null,"preventionTips":["Trim ref lists at the call site to the variant's cap","Centralize the 30/9, 10/3, 30/15 limit table in one constant module"],"tags":["validation","seedance","ark","reference-to-video","limits"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}