{"record":{"id":"f3990cb816cace21","repo":"babysor/MockingBird","slug":"reference-audio-not-found-reference-audio","errorCode":null,"errorMessage":"Reference audio not found: {reference_audio}","messagePattern":"Reference audio not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"skills/speak/scripts/noiz_tts.py","lineNumber":93,"sourceCode":"        \"speed\": str(speed),\n    }\n    if voice_id:\n        data[\"voice_id\"] = voice_id\n    if emo:\n        data[\"emo\"] = emo\n    if target_lang:\n        data[\"target_lang\"] = target_lang\n    if similarity_enh:\n        data[\"similarity_enh\"] = \"true\"\n    if save_voice:\n        data[\"save_voice\"] = \"true\"\n    if duration is not None:\n        data[\"duration\"] = str(duration)\n\n    files = None\n    if reference_audio:\n        if not reference_audio.exists():\n            raise FileNotFoundError(f\"Reference audio not found: {reference_audio}\")\n        files = {\n            \"file\": (\n                reference_audio.name,\n                reference_audio.open(\"rb\"),\n                \"application/octet-stream\",\n            )\n        }\n    elif not voice_id:\n        raise ValueError(\"Either --voice-id or --reference-audio is required.\")\n\n    try:\n        resp = requests.post(\n            url,\n            headers={\"Authorization\": api_key},\n            data=data,\n            files=files,\n            timeout=timeout,\n        )","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/babysor/MockingBird/blob/28dc5e14f12d7c754612af2fde8e78a4b03f8616/skills/speak/scripts/noiz_tts.py#L75-L111","documentation":"FileNotFoundError raised by synthesize() when reference_audio is provided as a Path but does not exist on disk. Voice cloning via reference audio requires a readable file that is uploaded as multipart form data.","triggerScenarios":"Passing --reference-audio /path/to/voice.wav where the file was deleted, is on a different machine, or the path is misspelled; also relative paths resolved from the wrong CWD.","commonSituations":"Hardcoded sample paths, running the script from a different working directory, or referencing files in a temp dir already cleaned up.","solutions":["Check the path exists and is absolute before calling synthesize","Verify spelling and CWD; use Path(__file__).resolve().parent anchors for bundled samples","Re-download or regenerate the missing reference file","Ensure the process has read permission on the file"],"exampleFix":"# before\nref = Path(\"voice.wav\")\nsynthesize(..., reference_audio=ref)\n# after\nref = Path(\"voice.wav\").resolve()\nif not ref.is_file():\n    sys.exit(f\"reference audio missing: {ref}\")\nsynthesize(..., reference_audio=ref)","handlingStrategy":"validation","validationCode":"from pathlib import Path\nref = Path(args.reference_audio).resolve()\nassert ref.is_file(), f'missing reference audio: {ref}'","typeGuard":null,"tryCatchPattern":"try:\n    synthesize(..., reference_audio=ref)\nexcept FileNotFoundError:\n    sys.exit(f'reference audio missing: {ref}')","preventionTips":["Resolve reference paths to absolute before use","Existence-check uploads before any network call","Keep voice samples in a stable, committed directory"],"tags":["filesystem","voice-clone","path","noiz-tts"],"backgroundTag":"file-not-found","analyzedSha":"28dc5e14f12d7c754612af2fde8e78a4b03f8616","analyzedAt":"2026-08-27T02:26:53.589Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}