calesthio/OpenMontage · error · FileNotFoundError

Image not found

Error message

Image not found: {path}

What it means

Raised by Hunyuan cloud video's _encode_image when the local image file passed for image_to_video does not exist (Path.is_file() is false). The helper base64-encodes a local image to inline it in the TokenHub request, and fails fast with the offending path before any network call.

Solutions

  1. Verify the path from the error exists on disk and fix typos.
  2. Use an absolute path to remove working-directory ambiguity.
  3. Confirm the upstream stage that generates the first-frame image completed successfully.
  4. Re-run with a fresh render of the source image if it was a temp file that got cleaned up.

Example fix

# before
{"operation": "image_to_video", "image_path": "tmp/frame.png"}

# after
{"operation": "image_to_video", "image_path": "/abs/project/out/tmp/frame.png"}
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

image_path = inputs.get("image_path")
if inputs.get("operation") == "image_to_video":
    if not image_path:
        raise ValueError("image_to_video requires image_path")
    p = Path(image_path).expanduser().resolve()
    if not p.is_file():
        raise FileNotFoundError(f"first-frame image missing: {p}")
    if p.stat().st_size > 6 * 1024 * 1024:
        raise ValueError(f"image too large: {p.stat().st_size} bytes (cap 6MB)")

Try / catch

try:
    result = hunyuan_cloud_video(inputs)
except FileNotFoundError as e:
    raise MissingAsset(f"regenerate first frame: {e}") from e

Prevention

When it happens

Trigger: Calling hunyuan_cloud_video with operation='image_to_video' and an image_path pointing to a nonexistent file; the encode step runs during payload construction.

Common situations: Relative paths resolved from a different cwd; the file was a temporary artifact already deleted; a pipeline stage that should have produced the first frame failed silently; path typos or wrong extension.

Related errors


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

Appendix: source

Thrown at tools/video/hunyuan_cloud_video.py:389

        """Resolve the TokenHub model ID.

        Order of precedence:
        1. Explicit ``model`` input
        2. Default based on operation (hy-video-1.5 for T2V, yt-video-2.0 for I2V)
        """
        if inputs.get("model"):
            return inputs["model"]
        operation = inputs.get("operation", "text_to_video")
        return _MODEL_I2V if operation == "image_to_video" else _MODEL_T2V

    @staticmethod
    def _encode_image(path: str) -> str:
        """Read a local image file and return a base64-encoded string."""
        import base64

        image_path = Path(path)
        if not image_path.is_file():
            raise FileNotFoundError(f"Image not found: {path}")

        raw = image_path.read_bytes()
        max_raw = 6 * 1024 * 1024  # 6MB raw ≈ 8MB base64
        if len(raw) > max_raw:
            raise ValueError(
                f"Image too large ({len(raw)} bytes). Max ~6MB raw (8MB base64-encoded)."
            )

        return base64.b64encode(raw).decode("ascii")

    # ------------------------------------------------------------------
    # API communication (TokenHub OpenAI-compatible)
    # ------------------------------------------------------------------

    @staticmethod
    def _auth_headers(api_key: str) -> dict[str, str]:
        """Build common request headers for TokenHub API calls."""
        return {

View on GitHub (pinned to 95e1c3d0ab)