{"record":{"id":"17f3f8cc21e04a13","repo":"Panniantong/Agent-Reach","slug":"ffprobe-timed-out-while-reading-audio-duration-aft","errorCode":null,"errorMessage":"ffprobe timed out while reading audio duration after {FFPROBE_TIMEOUT_SECONDS}s","messagePattern":"ffprobe timed out while reading audio duration after (.+?)s","errorType":"exception","errorClass":"TranscribeError","httpStatus":null,"severity":"error","filePath":"agent_reach/transcribe.py","lineNumber":115,"sourceCode":"        \"-v\",\n        \"error\",\n        \"-show_entries\",\n        \"format=duration\",\n        \"-of\",\n        \"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):","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/Panniantong/Agent-Reach/blob/93ae1d18c37b707dec053c7c4f9d91cd8ef8943d/agent_reach/transcribe.py#L97-L133","documentation":"Raised by _probe_audio_duration() in agent_reach/transcribe.py when the ffprobe subprocess exceeds FFPROBE_TIMEOUT_SECONDS (30 s) and subprocess.run raises TimeoutExpired. Bounding the probe prevents a hung ffprobe (e.g. on a pathological or corrupt file) from blocking the pipeline forever. from None suppresses the TimeoutExpired traceback for a cleaner error.","triggerScenarios":"Running ffprobe against a slow network mount, a named pipe, a corrupt/infinite container, or an overloaded CPU where reading format metadata takes over 30 s.","commonSituations":"Media on NFS/SMB shares with high latency; a truncated download that ffprobe scans endlessly; CI runners under heavy load.","solutions":["Copy the media to local disk before transcribing","Re-mux the file to repair container corruption: ffmpeg -i in.mp4 -c copy fixed.mp4","If genuinely slow media is expected, raise FFPROBE_TIMEOUT_SECONDS in your environment/config if the module exposes it, otherwise pre-validate duration yourself with a longer timeout"],"exampleFix":"# before: ffprobe hangs >30s on network mount\ntranscribe_audio(Path('/mnt/nas/talk.mp3'))\n\n# after: stage locally first\nimport shutil; shutil.copy('/mnt/nas/talk.mp3', '/tmp/talk.mp3')\ntranscribe_audio(Path('/tmp/talk.mp3'))","handlingStrategy":"retry","validationCode":"import subprocess\ntry:\n    subprocess.run(['ffprobe', '-v', 'error', '-show_entries', 'format=duration', '-i', str(path)], capture_output=True, timeout=60)\nexcept subprocess.TimeoutExpired:\n    raise ValueError('media not probeable in reasonable time; copy locally or repair')","typeGuard":null,"tryCatchPattern":"from agent_reach.transcribe import TranscribeError\ntry:\n    transcribe_audio(path)\nexcept TranscribeError as e:\n    if 'timed out' in str(e):\n        local = stage_to_tmp(path); transcribe_audio(local)  # one retry on local disk\n    else:\n        raise","preventionTips":["Stage remote-mounted media on local disk before transcription","Avoid named pipes and streaming URLs as inputs","Pre-probe with your own generous timeout to filter pathological files"],"tags":["timeout","ffprobe","media","transcription"],"backgroundTag":null,"analyzedSha":"93ae1d18c37b707dec053c7c4f9d91cd8ef8943d","analyzedAt":"2026-08-14T22:54:06.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}