babysor/MockingBird · error · FileNotFoundError

reference_audio not found: {ref}

Error message

reference_audio not found: {ref}

What it means

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.

Source

Thrown at skills/speak/scripts/render_timeline.py:237

def _bool_form(v: Any) -> str:
    return "true" if bool(v) else "false"


def _resolve_reference_audio(ref: str, timeout: int) -> Tuple[Path, Optional[Path]]:
    """Resolve reference_audio to a path. If ref is a URL, download to temp file.
    Returns (path_to_use, temp_path_to_cleanup_or_None)."""
    if ref.startswith("http://") or ref.startswith("https://"):
        import requests
        tmp = tempfile.NamedTemporaryFile(suffix=".wav", delete=False)
        tmp.close()
        r = requests.get(ref, timeout=timeout)
        r.raise_for_status()
        Path(tmp.name).write_bytes(r.content)
        return Path(tmp.name), Path(tmp.name)
    p = Path(ref)
    if not p.exists():
        raise FileNotFoundError(f"reference_audio not found: {ref}")
    return p, None


def _noiz_tts(
    base_url: str,
    api_key: str,
    cue: Cue,
    cfg: Dict[str, Any],
    output_format: str,
    timeout: int,
    out_path: Path,
) -> float:
    import requests

    url = f"{base_url.rstrip('/')}/text-to-speech"
    payload: Dict[str, str] = {
        "text": cue.text,
        "duration": f"{cue.duration_ms / 1000.0:.3f}",

View on GitHub (pinned to 28dc5e14f1)

Solutions

  1. Use absolute paths in the voice map config
  2. Verify the file exists before starting the render
  3. If it should be remote, use an http(s):// URL so it is fetched instead
  4. Anchor relative paths to the config file's directory

Example fix

# before (voice_map.json)
{"narrator": {"reference_audio": "voices/narrator.wav"}}
# after
{"narrator": {"reference_audio": "/abs/path/voices/narrator.wav"}}
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
p = Path(ref)
if not str(ref).startswith(('http://','https://')):
    assert p.is_file(), f'reference audio missing: {ref}'

Type guard

def is_resolvable_reference(ref) -> bool:
    return str(ref).startswith(('http://','https://')) or Path(ref).is_file()

Try / catch

try:
    path, cleanup = _resolve_reference_audio(ref, timeout)
except FileNotFoundError:
    sys.exit(f'voice map references missing file: {ref}')

Prevention

When it happens

Trigger: 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.

Common situations: Running render_timeline from a different directory than the voice map's paths assume; voice samples stored outside the repo on another machine.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of babysor/MockingBird@28dc5e14f1 (2026-08-27). Data as JSON: /api/errors/d7e8b5228cdfc6d2. Report an issue: GitHub.