{"record":{"id":"a6f48e64b1abe1a1","repo":"jamiepine/voicebox","slug":"file-exceeds-max-transcribe-bytes-1024-1024","errorCode":null,"errorMessage":"File exceeds {MAX_TRANSCRIBE_BYTES // (1024 * 1024)} MB limit.","messagePattern":"File exceeds (.+?) MB limit\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"backend/mcp_server/tools.py","lineNumber":149,"sourceCode":"                \"Pass exactly one of `audio_base64` or `audio_path`.\"\n            )\n\n        # Absolute-path mode: validate and transcribe in place. Restricted\n        # to loopback callers so a Voicebox bound on 0.0.0.0 doesn't double\n        # as an unauthenticated arbitrary-local-file read primitive.\n        if audio_path is not None:\n            if not request_is_loopback():\n                raise ValueError(\n                    \"`audio_path` is only available to loopback callers — \"\n                    \"remote callers must use `audio_base64`.\"\n                )\n            path = Path(audio_path)\n            if not path.is_absolute():\n                raise ValueError(\"`audio_path` must be absolute.\")\n            if not path.is_file():\n                raise ValueError(f\"File not found: {audio_path}\")\n            if path.stat().st_size > MAX_TRANSCRIBE_BYTES:\n                raise ValueError(\n                    f\"File exceeds {MAX_TRANSCRIBE_BYTES // (1024 * 1024)} MB limit.\"\n                )\n            return await _transcribe_file(path, language, model)\n\n        # Base64 mode: decode into a temp file, transcribe, clean up.\n        try:\n            raw = b64.b64decode(audio_base64, validate=True)\n        except Exception as exc:\n            raise ValueError(f\"Invalid audio_base64: {exc}\") from exc\n        if len(raw) > MAX_TRANSCRIBE_BYTES:\n            raise ValueError(\n                f\"Audio exceeds {MAX_TRANSCRIBE_BYTES // (1024 * 1024)} MB limit.\"\n            )\n        with tempfile.NamedTemporaryFile(\n            suffix=\".wav\", delete=False\n        ) as tmp:\n            tmp.write(raw)\n            tmp_path = Path(tmp.name)","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/jamiepine/voicebox/blob/51f49dea198384b4eb6087b72c17057c6eb1c1cd/backend/mcp_server/tools.py#L131-L167","documentation":"Raised by voicebox_transcribe in audio_path mode when path.stat().st_size exceeds MAX_TRANSCRIBE_BYTES, which is 200 * 1024 * 1024 (200 MB). The message formats the limit in whole megabytes.","triggerScenarios":"Submitting an audio file larger than 200 MB via audio_path (e.g. a multi-hour recording, a lossless WAV instead of compressed audio).","commonSituations":"Long dictations exported as uncompressed PCM/WAV; concatenated sessions; forgetting that Whisper transcribes short clips rather than whole archives.","solutions":["Trim or segment the audio into clips under 200 MB each and transcribe them separately.","Re-encode to a more compact container/bitrate (e.g. 16 kHz mono FLAC/Opus) before submitting.","For very long audio, drive a chunked transcription pipeline instead of one giant file."],"exampleFix":"// before\nvoicebox_transcribe(audio_path=\"/tmp/4hour.wav\")  // >200MB\n// after\n# split into 30-min segments, then\nvoicebox_transcribe(audio_path=\"/tmp/seg_001.wav\")","handlingStrategy":"validation","validationCode":"from backend.mcp_server.tools import MAX_TRANSCRIBE_BYTES\nfrom pathlib import Path\nsize = Path(audio_path).stat().st_size\nif size > MAX_TRANSCRIBE_BYTES:\n    raise ValueError(f\"{audio_path} is {size} bytes > {MAX_TRANSCRIBE_BYTES}\")\nawait voicebox_transcribe(audio_path=audio_path)","typeGuard":"def audio_under_file_limit(value: str, limit: int = 200 * 1024 * 1024) -> bool:\n    from pathlib import Path\n    return Path(value).stat().st_size <= limit","tryCatchPattern":"try:\n    await voicebox_transcribe(audio_path=audio_path)\nexcept ValueError as exc:\n    if \"MB limit\" in str(exc):\n        # segment the file and transcribe each chunk\n        for clip in segment_audio(audio_path, max_bytes=150 * 1024 * 1024):\n            await voicebox_transcribe(audio_path=clip)\n    else:\n        raise","preventionTips":["Pre-encode long audio to 16 kHz mono FLAC/Opus to shrink size.","Segment multi-hour recordings into <200 MB clips before transcription.","Check file size on the caller side before sending."],"tags":["mcp","size-limit","transcription","filesystem"],"backgroundTag":null,"analyzedSha":"51f49dea198384b4eb6087b72c17057c6eb1c1cd","analyzedAt":"2026-08-12T16:51:42.824Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}