{"record":{"id":"a29ccd9a8b114f60","repo":"calesthio/OpenMontage","slug":"image-not-found-path","errorCode":null,"errorMessage":"Image not found: {path}","messagePattern":"Image not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"tools/video/hunyuan_cloud_video.py","lineNumber":389,"sourceCode":"        \"\"\"Resolve the TokenHub model ID.\n\n        Order of precedence:\n        1. Explicit ``model`` input\n        2. Default based on operation (hy-video-1.5 for T2V, yt-video-2.0 for I2V)\n        \"\"\"\n        if inputs.get(\"model\"):\n            return inputs[\"model\"]\n        operation = inputs.get(\"operation\", \"text_to_video\")\n        return _MODEL_I2V if operation == \"image_to_video\" else _MODEL_T2V\n\n    @staticmethod\n    def _encode_image(path: str) -> str:\n        \"\"\"Read a local image file and return a base64-encoded string.\"\"\"\n        import base64\n\n        image_path = Path(path)\n        if not image_path.is_file():\n            raise FileNotFoundError(f\"Image not found: {path}\")\n\n        raw = image_path.read_bytes()\n        max_raw = 6 * 1024 * 1024  # 6MB raw ≈ 8MB base64\n        if len(raw) > max_raw:\n            raise ValueError(\n                f\"Image too large ({len(raw)} bytes). Max ~6MB raw (8MB base64-encoded).\"\n            )\n\n        return base64.b64encode(raw).decode(\"ascii\")\n\n    # ------------------------------------------------------------------\n    # API communication (TokenHub OpenAI-compatible)\n    # ------------------------------------------------------------------\n\n    @staticmethod\n    def _auth_headers(api_key: str) -> dict[str, str]:\n        \"\"\"Build common request headers for TokenHub API calls.\"\"\"\n        return {","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/hunyuan_cloud_video.py#L371-L407","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the path from the error exists on disk and fix typos.","Use an absolute path to remove working-directory ambiguity.","Confirm the upstream stage that generates the first-frame image completed successfully.","Re-run with a fresh render of the source image if it was a temp file that got cleaned up."],"exampleFix":"# before\n{\"operation\": \"image_to_video\", \"image_path\": \"tmp/frame.png\"}\n\n# after\n{\"operation\": \"image_to_video\", \"image_path\": \"/abs/project/out/tmp/frame.png\"}","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\nimage_path = inputs.get(\"image_path\")\nif inputs.get(\"operation\") == \"image_to_video\":\n    if not image_path:\n        raise ValueError(\"image_to_video requires image_path\")\n    p = Path(image_path).expanduser().resolve()\n    if not p.is_file():\n        raise FileNotFoundError(f\"first-frame image missing: {p}\")\n    if p.stat().st_size > 6 * 1024 * 1024:\n        raise ValueError(f\"image too large: {p.stat().st_size} bytes (cap 6MB)\")","typeGuard":null,"tryCatchPattern":"try:\n    result = hunyuan_cloud_video(inputs)\nexcept FileNotFoundError as e:\n    raise MissingAsset(f\"regenerate first frame: {e}\") from e","preventionTips":["Pass absolute paths for the first-frame image.","Validate existence and size in one precheck (also covers error 249).","Confirm the frame-extraction stage wrote its output before calling the tool."],"tags":["hunyuan","tokenhub","file-not-found","local-file","validation"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}