calesthio/OpenMontage · error · FileNotFoundError
Input file not found: {path}
Error message
Input file not found: {path} What it means
Raised by _file_to_data_uri in the Grok video tool when a supplied local file path does not exist. The helper converts local media to a base64 data: URI for the xAI API; it checks Path.exists() first and raises FileNotFoundError with the exact path so the caller can see what was missing.
Source
Thrown at tools/video/grok_video.py:33
from tools.base_tool import (
BaseTool,
Determinism,
ExecutionMode,
ResourceProfile,
RetryPolicy,
ToolResult,
ToolRuntime,
ToolStability,
ToolStatus,
ToolTier,
)
def _file_to_data_uri(path_str: str) -> str:
path = Path(path_str)
if not path.exists():
raise FileNotFoundError(f"Input file not found: {path}")
mime_type, _ = mimetypes.guess_type(path.name)
if not mime_type:
mime_type = "application/octet-stream"
encoded = base64.b64encode(path.read_bytes()).decode("ascii")
return f"data:{mime_type};base64,{encoded}"
def _normalize_media_ref(url_value: str | None, path_value: str | None) -> dict[str, str] | None:
if url_value:
return {"url": url_value}
if path_value:
return {"url": _file_to_data_uri(path_value)}
return None
class GrokVideo(BaseTool):
name = "grok_video"
version = "0.1.0"View on GitHub (pinned to 95e1c3d0ab)
Solutions
- Check the path in the error message exists (ls) and fix typos or missing directories.
- Pass absolute paths instead of relative paths to avoid working-directory ambiguity.
- If the file is produced by a prior pipeline stage, verify that stage succeeded before calling grok_video.
- Use image_url/reference_image_urls instead when the media is hosted remotely.
Example fix
# before
{"operation": "image_to_video", "image_path": "img/frame1.png"} # relative, cwd-dependent
# after
{"operation": "image_to_video", "image_path": "/abs/path/to/img/frame1.png"} Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
def require_media_file(path_value: str | None, key: str) -> str:
if not path_value:
raise ValueError(f"{key} is required")
p = Path(path_value).expanduser().resolve()
if not p.is_file():
raise FileNotFoundError(f"{key} file missing: {p}")
return str(p)
inputs["image_path"] = require_media_file(inputs.get("image_path"), "image_path") Type guard
from pathlib import Path
def is_readable_file(v: object) -> bool:
return isinstance(v, str) and len(v) > 0 and Path(v).expanduser().resolve().is_file() Try / catch
try:
result = grok_video(inputs)
except FileNotFoundError as e:
# resolve to absolute path and fail loudly — retrying the same path is futile
raise MissingAsset(str(e)) from e Prevention
- Always pass absolute paths to media inputs.
- Assert upstream render stages exit 0 before invoking grok_video.
- Validate file existence in your own glue code before building tool inputs.
When it happens
Trigger: Any grok_video operation that receives image_path or reference_image_paths (image_to_video, reference_to_video): the referenced file is absent at that location when the payload is built, before any network call is made.
Common situations: Relative paths resolved against a different working directory; typos in the path; files cleaned up by an earlier pipeline stage; paths from another machine/environment; race where a preceding render step has not written the file yet.
Related errors
- Image not found: {image_path}
- {label} not found: {media_path}
- Input file not found: {path}
- Image not found: {path}
- media not found
AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15).
Data as JSON: /api/errors/3419fb43e1a58c08.
Report an issue: GitHub.