{"record":{"id":"4e92e5e784ec6288","repo":"Panniantong/Agent-Reach","slug":"ffprobe-could-not-read-audio-duration-exc","errorCode":null,"errorMessage":"ffprobe could not read audio duration: {exc}","messagePattern":"ffprobe could not read audio duration: (.+?)","errorType":"exception","errorClass":"TranscribeError","httpStatus":null,"severity":"error","filePath":"agent_reach/transcribe.py","lineNumber":120,"sourceCode":"        \"default=noprint_wrappers=1:nokey=1\",\n        \"-i\",\n        str(path),\n    ]\n    try:\n        proc = subprocess.run(\n            cmd,\n            capture_output=True,\n            encoding=\"utf-8\",\n            errors=\"replace\",\n            timeout=FFPROBE_TIMEOUT_SECONDS,\n        )\n    except subprocess.TimeoutExpired:\n        raise TranscribeError(\n            \"ffprobe timed out while reading audio duration \"\n            f\"after {FFPROBE_TIMEOUT_SECONDS}s\"\n        ) from None\n    except OSError as exc:\n        raise TranscribeError(\n            f\"ffprobe could not read audio duration: {exc}\"\n        ) from exc\n\n    if proc.returncode != 0:\n        detail = proc.stderr.strip()[:300] or \"unknown ffprobe error\"\n        raise TranscribeError(\n            f\"ffprobe failed while reading audio duration: {detail}\"\n        )\n\n    raw_duration = proc.stdout.strip()\n    try:\n        duration = float(raw_duration)\n    except (TypeError, ValueError):\n        raise TranscribeError(\n            \"ffprobe could not parse a valid audio duration\"\n        ) from None\n    if not math.isfinite(duration) or duration <= 0:\n        raise TranscribeError(","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/Panniantong/Agent-Reach/blob/93ae1d18c37b707dec053c7c4f9d91cd8ef8943d/agent_reach/transcribe.py#L102-L138","documentation":"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.","triggerScenarios":"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.","commonSituations":"Copied ffmpeg/ffprobe without the exec bit; arm64 host with an x86_64 binary; broken package installs; system out of memory/processes.","solutions":["Check the executable: ls -l $(which ffprobe) and chmod +x or reinstall the package","Run ffprobe -version by hand to confirm it starts","Match the binary to your architecture (use the distro package manager rather than manual downloads)"],"exampleFix":"# before: OSError chained -> ffprobe could not read audio duration\ntranscribe_audio(path)\n\n# after\nsudo apt-get install --reinstall ffmpeg  # restores a working ffprobe\ntranscribe_audio(path)","handlingStrategy":"validation","validationCode":"import shutil, os\nexe = shutil.which('ffprobe')\nif exe is None or not os.access(exe, os.X_OK):\n    raise RuntimeError('ffprobe missing or not executable')","typeGuard":"def ffprobe_executable() -> bool:\n    import shutil, os\n    exe = shutil.which('ffprobe')\n    return exe is not None and os.access(exe, os.X_OK)","tryCatchPattern":"from agent_reach.transcribe import TranscribeError\ntry:\n    transcribe_audio(path)\nexcept TranscribeError as e:\n    if 'could not read audio duration' in str(e) and not shutil.which('ffprobe'):\n        raise SystemExit('broken ffprobe install; reinstall ffmpeg') from e\n    raise","preventionTips":["Install ffmpeg via the system package manager, not manual binary drops","Smoke-test `ffprobe -version` in deployment checks","Include ffprobe executability in a doctor step"],"tags":["ffmpeg","os-error","permissions","environment"],"backgroundTag":null,"analyzedSha":"93ae1d18c37b707dec053c7c4f9d91cd8ef8943d","analyzedAt":"2026-08-14T22:54:06.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}