{"record":{"id":"0ecb97144e2d070a","repo":"fishaudio/fish-speech","slug":"reference-audio-file-not-found-ref-audio","errorCode":null,"errorMessage":"Reference audio file not found: {ref_audio}","messagePattern":"Reference audio file not found: (.+?)","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"tools/api_client.py","lineNumber":159,"sourceCode":"    args = parse_args()\n\n    idstr: str | None = args.reference_id\n    # priority: ref_id > [{text, audio},...]\n    if idstr is None:\n        ref_audios = args.reference_audio or []\n        ref_texts = args.reference_text or []\n\n        if len(ref_audios) != len(ref_texts):\n            raise SystemExit(\n                \"--reference_audio and --reference_text must be given the same number \"\n                f\"of values, got {len(ref_audios)} audio(s) and {len(ref_texts)} text(s).\"\n            )\n\n        byte_audios = []\n        for ref_audio in ref_audios:\n            audio_bytes = audio_to_bytes(ref_audio)\n            if audio_bytes is None:\n                raise SystemExit(f\"Reference audio file not found: {ref_audio}\")\n            byte_audios.append(audio_bytes)\n\n        ref_texts = [read_ref_text(ref_text) for ref_text in ref_texts]\n    else:\n        byte_audios = []\n        ref_texts = []\n        pass  # in api.py\n\n    data = {\n        \"text\": args.text,\n        \"references\": [\n            ServeReferenceAudio(audio=ref_audio, text=ref_text)\n            for ref_text, ref_audio in zip(ref_texts, byte_audios)\n        ],\n        \"reference_id\": idstr,\n        \"format\": args.format,\n        \"latency\": args.latency,\n        \"max_new_tokens\": args.max_new_tokens,","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/fishaudio/fish-speech/blob/befe4001745417f8c42131739d862b8a6fdbd15a/tools/api_client.py#L141-L177","documentation":"api_client.py converts each reference audio path to bytes via audio_to_bytes; if the file cannot be read (usually because it doesn't exist) the helper returns None and the client exits with SystemExit naming the path.","triggerScenarios":"Passing --reference_audio /path/that/does/not/exist.wav, or a path with wrong permissions, or a directory.","commonSituations":"Typos in paths, relative paths resolved from the wrong CWD, files moved after copy-pasting a command from notes.","solutions":["Verify the path exists (ls) before running; use absolute paths","Fix typos/extension mismatches (.way vs .wav)","Ensure read permission on the file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from pathlib import Path\nmissing = [a for a in args.reference_audio if not Path(a).is_file()]\nassert not missing, f\"missing files: {missing}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use absolute paths","Check files exist before long batch runs"],"tags":["api-client","file-not-found","cli"],"backgroundTag":"file-not-found","analyzedSha":"befe4001745417f8c42131739d862b8a6fdbd15a","analyzedAt":"2026-08-27T21:31:45.703Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}