{"record":{"id":"49e8de1f99927a10","repo":"calesthio/OpenMontage","slug":"gemini-omni-video-edit-accepts-at-most-10-referenc","errorCode":null,"errorMessage":"Gemini Omni video_edit accepts at most 10 reference images","messagePattern":"Gemini Omni video_edit accepts at most 10 reference images","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/atlas_video.py","lineNumber":292,"sourceCode":"            if not refers or not any(item.get(\"type\") in {\"image\", \"video\"} for item in refers):\n                raise ValueError(\"MiniMax H3 reference_to_video requires at least one image or video in refers\")\n            payload[\"refers\"] = refers\n        elif style == \"gemini_video_clips\":\n            clips = list(inputs.get(\"video_clips\") or [])\n            if not clips and video:\n                clips = [{\"url\": video, \"start\": 0, \"ends\": min(int(inputs.get(\"duration\", 10)), 10)}]\n            if len(clips) != 1:\n                raise ValueError(\"Gemini Omni developer reference_to_video requires exactly one video_clip\")\n            payload[\"video_clips\"] = clips\n            if images:\n                payload[\"images\"] = images\n        elif style == \"gemini_video_edit\":\n            if not video:\n                raise ValueError(\"video_edit requires video_url, video_path, or reference_video_path\")\n            payload[\"video\"] = video\n            if images:\n                if len(images) > spec[\"media_limits\"].get(\"images\", 10):\n                    raise ValueError(\"Gemini Omni video_edit accepts at most 10 reference images\")\n                payload[\"images\"] = images\n\n        extra = inputs.get(\"extra_params\")\n        if isinstance(extra, dict):\n            payload.update(extra)\n        return payload\n\n    @staticmethod\n    def _upload_value(value: str | None, api_key: str) -> str | None:\n        if not value or _is_remote(value):\n            return value\n        return atlas_client.upload_media(value, api_key)\n\n    def _resolve_media(self, inputs: dict[str, Any], api_key: str) -> dict[str, Any]:\n        resolved = dict(inputs)\n        resolved[\"reference_images\"] = [\n            *(resolved.get(\"reference_images\") or []),\n            *(resolved.get(\"reference_image_urls\") or []),","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/atlas_video.py#L274-L310","documentation":"Raised in _build_payload for gemini_video_edit when the number of reference images exceeds the cap read from spec['media_limits'].get('images', 10). The hardcoded message says 10, matching the default; if a spec declares a lower cap the check uses that number but the message text still says 10.","triggerScenarios":"Passing 11+ reference_images alongside the edit video on the Gemini Omni route; a spec defining media_limits['images'] below 10 while the caller sends 10 images (check fails, message misleadingly claims the cap is 10).","commonSituations":"Batch pipelines attaching every storyboard frame as an edit reference; porting a seedance multi-reference call (which allows far more) to the Gemini edit route.","solutions":["Trim reference_images to at most 10 (or the spec's media_limits['images'] if lower — verify via get_info())","Prefer fewer, high-impact reference images for edit guidance","If you need more references, use a reference_to_video model with higher media_limits"],"exampleFix":"# before\ninputs = {'model':'google/gemini-omni-flash','operation':'video_edit','video_url':v,'reference_images':frames}  # len(frames)=25\n\n# after\ninputs = {'model':'google/gemini-omni-flash','operation':'video_edit','video_url':v,'reference_images':frames[:10]}","handlingStrategy":"validation","validationCode":"cap = atlas_video.get_info()['model_catalog'][model]['media_limits'].get('images', 10)\nimgs = inputs.get('reference_images') or []\nif len(imgs) > cap:\n    inputs['reference_images'] = imgs[:cap]  # keep the strongest refs first","typeGuard":"def within_edit_image_cap(inputs: dict, cap: int = 10) -> bool:\n    return len(inputs.get('reference_images') or []) <= cap","tryCatchPattern":"try:\n    result = atlas_video.run(inputs=inputs)\nexcept ValueError as e:\n    if 'video_edit accepts at most' in str(e):\n        inputs['reference_images'] = inputs['reference_images'][:10]\n        result = atlas_video.run(inputs=inputs)\n    else:\n        raise","preventionTips":["Order reference images by importance before truncating","Read the cap from media_limits, not from the message text (message hardcodes 10)","Reserve heavy multi-reference work for reference_to_video models"],"tags":["atlas-cloud","gemini","video-edit","limits","validation"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}