{"record":{"id":"d7e8b5228cdfc6d2","repo":"babysor/MockingBird","slug":"reference-audio-not-found-ref","errorCode":null,"errorMessage":"reference_audio not found: {ref}","messagePattern":"reference_audio not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"skills/speak/scripts/render_timeline.py","lineNumber":237,"sourceCode":"\ndef _bool_form(v: Any) -> str:\n    return \"true\" if bool(v) else \"false\"\n\n\ndef _resolve_reference_audio(ref: str, timeout: int) -> Tuple[Path, Optional[Path]]:\n    \"\"\"Resolve reference_audio to a path. If ref is a URL, download to temp file.\n    Returns (path_to_use, temp_path_to_cleanup_or_None).\"\"\"\n    if ref.startswith(\"http://\") or ref.startswith(\"https://\"):\n        import requests\n        tmp = tempfile.NamedTemporaryFile(suffix=\".wav\", delete=False)\n        tmp.close()\n        r = requests.get(ref, timeout=timeout)\n        r.raise_for_status()\n        Path(tmp.name).write_bytes(r.content)\n        return Path(tmp.name), Path(tmp.name)\n    p = Path(ref)\n    if not p.exists():\n        raise FileNotFoundError(f\"reference_audio not found: {ref}\")\n    return p, None\n\n\ndef _noiz_tts(\n    base_url: str,\n    api_key: str,\n    cue: Cue,\n    cfg: Dict[str, Any],\n    output_format: str,\n    timeout: int,\n    out_path: Path,\n) -> float:\n    import requests\n\n    url = f\"{base_url.rstrip('/')}/text-to-speech\"\n    payload: Dict[str, str] = {\n        \"text\": cue.text,\n        \"duration\": f\"{cue.duration_ms / 1000.0:.3f}\",","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/babysor/MockingBird/blob/28dc5e14f12d7c754612af2fde8e78a4b03f8616/skills/speak/scripts/render_timeline.py#L219-L255","documentation":"FileNotFoundError raised by _resolve_reference_audio when a reference_audio value that is not an http(s) URL does not exist as a local path. URLs are downloaded to a temp file; local paths must exist.","triggerScenarios":"Voice map in the timeline config gives a relative reference_audio path resolved from the wrong CWD, a typo'd filename, or a file removed since config was written.","commonSituations":"Running render_timeline from a different directory than the voice map's paths assume; voice samples stored outside the repo on another machine.","solutions":["Use absolute paths in the voice map config","Verify the file exists before starting the render","If it should be remote, use an http(s):// URL so it is fetched instead","Anchor relative paths to the config file's directory"],"exampleFix":"# before (voice_map.json)\n{\"narrator\": {\"reference_audio\": \"voices/narrator.wav\"}}\n# after\n{\"narrator\": {\"reference_audio\": \"/abs/path/voices/narrator.wav\"}}","handlingStrategy":"validation","validationCode":"from pathlib import Path\np = Path(ref)\nif not str(ref).startswith(('http://','https://')):\n    assert p.is_file(), f'reference audio missing: {ref}'","typeGuard":"def is_resolvable_reference(ref) -> bool:\n    return str(ref).startswith(('http://','https://')) or Path(ref).is_file()","tryCatchPattern":"try:\n    path, cleanup = _resolve_reference_audio(ref, timeout)\nexcept FileNotFoundError:\n    sys.exit(f'voice map references missing file: {ref}')","preventionTips":["Use absolute paths or http URLs in voice maps","Validate the whole voice map before rendering","Keep voice samples alongside the project"],"tags":["filesystem","voice-clone","config","path"],"backgroundTag":"file-not-found","analyzedSha":"28dc5e14f12d7c754612af2fde8e78a4b03f8616","analyzedAt":"2026-08-27T02:26:53.589Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}