calesthio/OpenMontage · error · FileNotFoundError

Input video not found: {path}

Error message

Input video not found: {path}

What it means

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.

Source

Thrown at tools/video/gemini_omni_video.py:224

    @staticmethod
    def _image_part(path_str: str) -> dict[str, Any]:
        path = Path(path_str)
        if not path.exists():
            raise FileNotFoundError(f"Reference image not found: {path}")
        mime_type, _ = mimetypes.guess_type(path.name)
        if not mime_type or not mime_type.startswith("image/"):
            mime_type = "image/png"
        return {
            "type": "image",
            "data": base64.b64encode(path.read_bytes()).decode("ascii"),
            "mime_type": mime_type,
        }

    def _upload_video_file(self, requests_mod: Any, api_key: str, path_str: str) -> str:
        """Upload a local video via the Files API (resumable) and return its URI."""
        path = Path(path_str)
        if not path.exists():
            raise FileNotFoundError(f"Input video not found: {path}")
        mime_type, _ = mimetypes.guess_type(path.name)
        if not mime_type or not mime_type.startswith("video/"):
            mime_type = "video/mp4"
        video_bytes = path.read_bytes()

        start_resp = requests_mod.post(
            _UPLOAD_URL,
            headers={
                "x-goog-api-key": api_key,
                "X-Goog-Upload-Protocol": "resumable",
                "X-Goog-Upload-Command": "start",
                "X-Goog-Upload-Header-Content-Length": str(len(video_bytes)),
                "X-Goog-Upload-Header-Content-Type": mime_type,
                "Content-Type": "application/json",
            },
            json={"file": {"display_name": path.name}},
            timeout=30,
        )

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Verify the file exists and is a non-empty video before calling (Path.is_file() and size check)
  2. Use absolute, resolved paths; log the exact path string being passed
  3. If the video comes from a prior step, assert that step's output exists before proceeding

Example fix

# before
inputs = {'prompt':'remove the logo','video_path':'cache/clip.mp4'}  # never downloaded

# after
from pathlib import Path
vid = Path('cache/clip.mp4').resolve()
if not vid.is_file():
    raise SystemExit(f'download step failed: {vid} missing')
inputs = {'prompt':'remove the logo','video_path':str(vid)}
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
p = Path(video_path).expanduser().resolve()
if not p.is_file() or p.stat().st_size == 0:
    raise FileNotFoundError(f'input video missing or empty: {p}')
inputs['video_path'] = str(p)

Type guard

def video_ready(path_str: str) -> bool:
    p = Path(path_str).expanduser()
    return p.is_file() and p.stat().st_size > 0

Try / catch

try:
    result = gemini_omni_video.run(inputs=inputs)
except FileNotFoundError as e:
    raise SystemExit(f'video source missing — check the download/cut step: {e}') from e

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/85bde09ef782591d. Report an issue: GitHub.