{"record":{"id":"77b9d854e3daae20","repo":"calesthio/OpenMontage","slug":"local-reference-image-not-found-path","errorCode":null,"errorMessage":"Local reference image not found: {path}","messagePattern":"Local reference image not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"tools/audio/google_music.py","lineNumber":203,"sourceCode":"                import logging\n\n                logging.getLogger(__name__).warning(\n                    \"Lyria 3 Pro supports up to 184 seconds of audio. Coercing duration_seconds to 184.\"\n                )\n                duration = 184.0\n            else:\n                return ToolResult(\n                    success=False,\n                    error=\"lyria-3-pro-preview maximum duration is 184 seconds.\",\n                )\n\n        # Helper to load reference image bytes + mime type\n        def _get_image_data(\n            url: str | None, path: str | None\n        ) -> tuple[str, str] | None:\n            if path:\n                if not os.path.exists(path):\n                    raise FileNotFoundError(f\"Local reference image not found: {path}\")\n                img_bytes = Path(path).read_bytes()\n                mime, _ = mimetypes.guess_type(path)\n                if not mime:\n                    mime = \"image/png\"\n                b64 = base64.b64encode(img_bytes).decode(\"utf-8\")\n                return b64, mime\n            if url:\n                resp = requests.get(url, timeout=30)\n                resp.raise_for_status()\n                mime = resp.headers.get(\"Content-Type\")\n                if not mime or \"image\" not in mime:\n                    mime = \"image/png\"\n                b64 = base64.b64encode(resp.content).decode(\"utf-8\")\n                return b64, mime\n            return None\n\n        # Build payload input incorporating target duration instructions\n        timed_prompt = f\"{prompt}\\n\\n[Target Duration: {int(duration)} seconds]\"","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/audio/google_music.py#L185-L221","documentation":"Raised by the inline helper _get_image_data in google_music when the caller supplies a local reference-image path for image-to-music but that path does not exist on disk. The helper checks os.path.exists before reading bytes for base64-encoding into the Lyria request.","triggerScenarios":"Passing reference_image_path that is a relative path resolved against the wrong working directory, a typo, or a file produced by an earlier pipeline step that did not run.","commonSituations":"Relative paths when the process cwd differs from the project root; multi-stage pipelines where the image-generation step failed silently before music generation; containerized runs where the path was not mounted.","solutions":["Verify the file exists and convert to an absolute path before calling the tool","Check earlier pipeline stages actually produced the reference image","In containers, confirm the path is inside a mounted volume"],"exampleFix":"// before\ninputs = {\"prompt\": \"...\", \"reference_image_path\": \"assets/ref.png\"}\n\n// after\nimport os\np = os.path.abspath(\"assets/ref.png\")\nassert os.path.exists(p), f\"missing reference image: {p}\"\ninputs = {\"prompt\": \"...\", \"reference_image_path\": p}","handlingStrategy":"validation","validationCode":"import os\npath = inputs.get(\"reference_image_path\")\nif path and not os.path.isfile(os.path.abspath(path)):\n    raise FileNotFoundError(f\"reference image missing: {path}\")","typeGuard":null,"tryCatchPattern":"try:\n    result = google_music_tool.execute(inputs)\nexcept FileNotFoundError as e:\n    # fall back to text-only music generation\n    inputs.pop(\"reference_image_path\", None)\n    result = google_music_tool.execute(inputs)","preventionTips":["Normalize image paths to absolute paths at pipeline assembly time","Fail the image-generation stage loudly so music never runs with a stale path","In containers, validate mounts before the run"],"tags":["google-music","lyria","file-not-found","reference-image"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}