{"record":{"id":"85bde09ef782591d","repo":"calesthio/OpenMontage","slug":"input-video-not-found-path","errorCode":null,"errorMessage":"Input video not found: {path}","messagePattern":"Input video not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"tools/video/gemini_omni_video.py","lineNumber":224,"sourceCode":"    @staticmethod\n    def _image_part(path_str: str) -> dict[str, Any]:\n        path = Path(path_str)\n        if not path.exists():\n            raise FileNotFoundError(f\"Reference image not found: {path}\")\n        mime_type, _ = mimetypes.guess_type(path.name)\n        if not mime_type or not mime_type.startswith(\"image/\"):\n            mime_type = \"image/png\"\n        return {\n            \"type\": \"image\",\n            \"data\": base64.b64encode(path.read_bytes()).decode(\"ascii\"),\n            \"mime_type\": mime_type,\n        }\n\n    def _upload_video_file(self, requests_mod: Any, api_key: str, path_str: str) -> str:\n        \"\"\"Upload a local video via the Files API (resumable) and return its URI.\"\"\"\n        path = Path(path_str)\n        if not path.exists():\n            raise FileNotFoundError(f\"Input video not found: {path}\")\n        mime_type, _ = mimetypes.guess_type(path.name)\n        if not mime_type or not mime_type.startswith(\"video/\"):\n            mime_type = \"video/mp4\"\n        video_bytes = path.read_bytes()\n\n        start_resp = requests_mod.post(\n            _UPLOAD_URL,\n            headers={\n                \"x-goog-api-key\": api_key,\n                \"X-Goog-Upload-Protocol\": \"resumable\",\n                \"X-Goog-Upload-Command\": \"start\",\n                \"X-Goog-Upload-Header-Content-Length\": str(len(video_bytes)),\n                \"X-Goog-Upload-Header-Content-Type\": mime_type,\n                \"Content-Type\": \"application/json\",\n            },\n            json={\"file\": {\"display_name\": path.name}},\n            timeout=30,\n        )","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/gemini_omni_video.py#L206-L242","documentation":"Raised as FileNotFoundError by GeminiOmniVideoTool._upload_video_file when the local input-video path for an edit/reference operation does not exist, before it starts the resumable Files API upload.","triggerScenarios":"Passing video_path that is missing, relative to another cwd, or deleted; pointing at a file a downloader was supposed to produce (wrong extension or output dir); path with typos or leftover quotes.","commonSituations":"Video-edit workflows where the source clip is fetched/cut by an earlier ffmpeg step that failed silently; temp-file cleanup between steps; job runners that change cwd between stages.","solutions":["Verify the file exists and is a non-empty video before calling (Path.is_file() and size check)","Use absolute, resolved paths; log the exact path string being passed","If the video comes from a prior step, assert that step's output exists before proceeding"],"exampleFix":"# before\ninputs = {'prompt':'remove the logo','video_path':'cache/clip.mp4'}  # never downloaded\n\n# after\nfrom pathlib import Path\nvid = Path('cache/clip.mp4').resolve()\nif not vid.is_file():\n    raise SystemExit(f'download step failed: {vid} missing')\ninputs = {'prompt':'remove the logo','video_path':str(vid)}","handlingStrategy":"validation","validationCode":"from pathlib import Path\np = Path(video_path).expanduser().resolve()\nif not p.is_file() or p.stat().st_size == 0:\n    raise FileNotFoundError(f'input video missing or empty: {p}')\ninputs['video_path'] = str(p)","typeGuard":"def video_ready(path_str: str) -> bool:\n    p = Path(path_str).expanduser()\n    return p.is_file() and p.stat().st_size > 0","tryCatchPattern":"try:\n    result = gemini_omni_video.run(inputs=inputs)\nexcept FileNotFoundError as e:\n    raise SystemExit(f'video source missing — check the download/cut step: {e}') from e","preventionTips":["Assert ffmpeg/download steps succeeded by checking their output file before the edit call","Keep source media in a stable workdir; avoid temp dirs that other stages clean","Use absolute paths throughout long pipelines"],"tags":["gemini","file-not-found","video-edit","validation"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}