{"record":{"id":"d067b63c80ce666e","repo":"calesthio/OpenMontage","slug":"gemini-omni-developer-reference-to-video-requires","errorCode":null,"errorMessage":"Gemini Omni developer reference_to_video requires exactly one video_clip","messagePattern":"Gemini Omni developer reference_to_video requires exactly one video_clip","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/atlas_video.py","lineNumber":282,"sourceCode":"        elif style == \"h3_refers\":\n            refers = list(inputs.get(\"refers\") or [])\n            if not refers:\n                refers = [\n                    *({\"url\": value, \"type\": \"image\"} for value in images),\n                    *({\"url\": value, \"type\": \"video\"} for value in videos),\n                    *({\"url\": value, \"type\": \"audio\"} for value in audios),\n                ]\n                if image:\n                    refers.insert(0, {\"url\": image, \"type\": \"image\"})\n            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","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/atlas_video.py#L264-L300","documentation":"Raised in _build_payload for media_style=='gemini_video_clips' when the video_clips list does not contain exactly one clip. The Gemini Omni developer reference route accepts a single video clip; if video_clips is absent but video_url/reference_video_url is set, one clip is auto-synthesized with start=0 and ends=min(duration,10), otherwise len(clips)!=1 fails.","triggerScenarios":"Passing two or more entries in video_clips; passing zero clips and no video_url; passing video_clips with a single malformed/None entry filtered to zero by list().","commonSituations":"Porting a multi-clip editing workflow to a single-clip endpoint; forgetting video_url so no default clip is created; a wrapper packaging clips as a dict instead of a list.","solutions":["Pass exactly one clip dict in video_clips (with url/start/ends fields per the route's schema)","Or simply pass video_url (or reference_video_url) and let the tool synthesize the single clip with start=0, ends=min(duration,10)","Split multi-clip edits into sequential single-clip calls"],"exampleFix":"# before\ninputs = {'model':'google/gemini-omni-dev','operation':'reference_to_video','video_clips':clip_a_and_b}\n\n# after\ninputs = {'model':'google/gemini-omni-dev','operation':'reference_to_video','video_clips':[{'url':clip_a['url'],'start':0,'ends':10}]}","handlingStrategy":"validation","validationCode":"clips = list(inputs.get('video_clips') or [])\nif not clips and (inputs.get('video_url') or inputs.get('reference_video_url')):\n    clips = [{'url': inputs.get('video_url') or inputs['reference_video_url'],\n              'start': 0, 'ends': min(int(inputs.get('duration', 10)), 10)}]\nif len(clips) != 1:\n    raise ValueError('exactly one video_clip required')\ninputs['video_clips'] = clips","typeGuard":"def single_clip(inputs: dict) -> bool:\n    clips = inputs.get('video_clips')\n    return (isinstance(clips, list) and len(clips) == 1 and\n            bool(clips[0].get('url')))","tryCatchPattern":"try:\n    result = atlas_video.run(inputs=inputs)\nexcept ValueError as e:\n    if 'exactly one video_clip' in str(e):\n        raise SystemExit('send one clip, or just video_url and let it default') from e\n    raise","preventionTips":["Pass video_url alone for the common case — the default clip covers it","Split multi-clip edits into sequential calls","Validate clip dicts (url/start/ends) before submission"],"tags":["atlas-cloud","gemini","video-generation","validation"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}