calesthio/OpenMontage · error · FileNotFoundError
Reference image not found: {path}
Error message
Reference image not found: {path} What it means
Raised as FileNotFoundError by GeminiOmniVideoTool._image_part when the local reference-image path does not exist on disk (Path.exists() is false) before it is base64-encoded into the request part.
Source
Thrown at tools/video/gemini_omni_video.py:210
raw = str(inputs.get("duration") or _DEFAULT_DURATION_SECONDS).strip().lower()
raw = raw[:-1] if raw.endswith("s") else raw
try:
seconds = int(float(raw))
except ValueError:
seconds = _DEFAULT_DURATION_SECONDS
return max(3, min(10, seconds))
def estimate_cost(self, inputs: dict[str, Any]) -> float:
return _COST_PER_SECOND * self._duration_hint(inputs)
def estimate_runtime(self, inputs: dict[str, Any]) -> float:
return 180.0
@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()View on GitHub (pinned to 95e1c3d0ab)
Solutions
- Check the path exists and is readable before the call (os.path.exists / pathlib)
- Use absolute paths (resolve with Path(...).resolve()) so cwd changes cannot break resolution
- If the image was supposed to come from an earlier step, verify that step's output path before invoking gemini_omni_video
Example fix
# before
inputs = {'prompt':'...','image_path':'tmp/ref.png'} # cwd moved
# after
from pathlib import Path
img = Path('tmp/ref.png').resolve()
assert img.is_file(), f'missing {img}'
inputs = {'prompt':'...','image_path':str(img)} Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
p = Path(image_path).expanduser().resolve()
if not p.is_file():
raise FileNotFoundError(f'reference image missing: {p}')
inputs['image_path'] = str(p) Type guard
def image_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'fix the image path: {e}') from e Prevention
- Resolve to absolute paths at pipeline start so cwd changes cannot break them
- Verify intermediate render/download steps produced their outputs before consuming them
- Expand ~ and strip user-supplied whitespace/quotes from paths
When it happens
Trigger: Passing an image_path that is misspelled, relative to a different working directory, or already moved/deleted; a path produced by a prior render step that failed or wrote elsewhere; leading/trailing whitespace or quotes in the path string.
Common situations: Long pipelines where an intermediate step cleans its temp dir; running the tool from a different cwd so a relative path no longer resolves; paths assembled from user input without normalization.
Related errors
- This Gemini route requires at least one reference image
- Gemini Omni developer reference_to_video requires exactly on
- Input video not found: {path}
- media not found
- Invalid stage: {stage!r} for pipeline {pipeline_type!r}. Val
AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15).
Data as JSON: /api/errors/adda6999743d8afd.
Report an issue: GitHub.