Panniantong/Agent-Reach · error · TranscribeError

ffprobe could not read audio duration: {exc}

Error message

ffprobe could not read audio duration: {exc}

What it means

Raised by _probe_audio_duration() in agent_reach/transcribe.py when spawning ffprobe itself fails at the OS level — subprocess.run raises OSError, meaning the executable could not be executed (permissions, exec format) or an OS-level error occurred before any output. It chains the original OSError (`from exc`) so the underlying errno is visible.

Source

Thrown at agent_reach/transcribe.py:120

        "default=noprint_wrappers=1:nokey=1",
        "-i",
        str(path),
    ]
    try:
        proc = subprocess.run(
            cmd,
            capture_output=True,
            encoding="utf-8",
            errors="replace",
            timeout=FFPROBE_TIMEOUT_SECONDS,
        )
    except subprocess.TimeoutExpired:
        raise TranscribeError(
            "ffprobe timed out while reading audio duration "
            f"after {FFPROBE_TIMEOUT_SECONDS}s"
        ) from None
    except OSError as exc:
        raise TranscribeError(
            f"ffprobe could not read audio duration: {exc}"
        ) from exc

    if proc.returncode != 0:
        detail = proc.stderr.strip()[:300] or "unknown ffprobe error"
        raise TranscribeError(
            f"ffprobe failed while reading audio duration: {detail}"
        )

    raw_duration = proc.stdout.strip()
    try:
        duration = float(raw_duration)
    except (TypeError, ValueError):
        raise TranscribeError(
            "ffprobe could not parse a valid audio duration"
        ) from None
    if not math.isfinite(duration) or duration <= 0:
        raise TranscribeError(

View on GitHub (pinned to 93ae1d18c3)

Solutions

  1. Check the executable: ls -l $(which ffprobe) and chmod +x or reinstall the package
  2. Run ffprobe -version by hand to confirm it starts
  3. Match the binary to your architecture (use the distro package manager rather than manual downloads)

Example fix

# before: OSError chained -> ffprobe could not read audio duration
transcribe_audio(path)

# after
sudo apt-get install --reinstall ffmpeg  # restores a working ffprobe
transcribe_audio(path)
Defensive patterns

Strategy: validation

Validate before calling

import shutil, os
exe = shutil.which('ffprobe')
if exe is None or not os.access(exe, os.X_OK):
    raise RuntimeError('ffprobe missing or not executable')

Type guard

def ffprobe_executable() -> bool:
    import shutil, os
    exe = shutil.which('ffprobe')
    return exe is not None and os.access(exe, os.X_OK)

Try / catch

from agent_reach.transcribe import TranscribeError
try:
    transcribe_audio(path)
except TranscribeError as e:
    if 'could not read audio duration' in str(e) and not shutil.which('ffprobe'):
        raise SystemExit('broken ffprobe install; reinstall ffmpeg') from e
    raise

Prevention

When it happens

Trigger: ffprobe exists in PATH but is not executable (permission denied), is a broken symlink, or is a binary for the wrong architecture; fork failures on exhausted systems.

Common situations: Copied ffmpeg/ffprobe without the exec bit; arm64 host with an x86_64 binary; broken package installs; system out of memory/processes.

Related errors


AI-assisted analysis of Panniantong/Agent-Reach@93ae1d18c3 (2026-08-14). Data as JSON: /api/errors/4e92e5e784ec6288. Report an issue: GitHub.