jamiepine/voicebox · error · ValueError
Audio exceeds {MAX_TRANSCRIBE_BYTES // (1024 * 1024)} MB lim
Error message
Audio exceeds {MAX_TRANSCRIBE_BYTES // (1024 * 1024)} MB limit. What it means
Raised by voicebox_transcribe in base64 mode when the decoded byte length len(raw) exceeds MAX_TRANSCRIBE_BYTES (200 MB). Unlike error 50 this fires after decoding, so it guards inflated base64 payloads rather than on-disk file size.
Source
Thrown at backend/mcp_server/tools.py:160
)
path = Path(audio_path)
if not path.is_absolute():
raise ValueError("`audio_path` must be absolute.")
if not path.is_file():
raise ValueError(f"File not found: {audio_path}")
if path.stat().st_size > MAX_TRANSCRIBE_BYTES:
raise ValueError(
f"File exceeds {MAX_TRANSCRIBE_BYTES // (1024 * 1024)} MB limit."
)
return await _transcribe_file(path, language, model)
# Base64 mode: decode into a temp file, transcribe, clean up.
try:
raw = b64.b64decode(audio_base64, validate=True)
except Exception as exc:
raise ValueError(f"Invalid audio_base64: {exc}") from exc
if len(raw) > MAX_TRANSCRIBE_BYTES:
raise ValueError(
f"Audio exceeds {MAX_TRANSCRIBE_BYTES // (1024 * 1024)} MB limit."
)
with tempfile.NamedTemporaryFile(
suffix=".wav", delete=False
) as tmp:
tmp.write(raw)
tmp_path = Path(tmp.name)
try:
return await _transcribe_file(tmp_path, language, model)
finally:
tmp_path.unlink(missing_ok=True)
@mcp.tool(
name="voicebox.list_captures",
description=(
"List recent voice captures (dictations, recordings, uploads) "
"with their transcripts. Most-recent first."
),View on GitHub (pinned to 51f49dea19)
Solutions
- Reduce the decoded audio to under 200 MB (trim, segment, or re-encode to 16 kHz mono).
- For local clients, switch to audio_path to skip the base64 round trip and the same 200 MB cap on file size.
- Batch long recordings into multiple under-limit calls.
Example fix
// before voicebox_transcribe(audio_base64=b64encode(huge_wav)) // after segments = split(huge_wav, max_bytes=150*1024*1024) for s in segments: voicebox_transcribe(audio_base64=b64encode(s))
Defensive patterns
Strategy: validation
Validate before calling
import base64
from backend.mcp_server.tools import MAX_TRANSCRIBE_BYTES
raw = base64.b64decode(audio_base64, validate=True)
if len(raw) > MAX_TRANSCRIBE_BYTES:
raise ValueError("decoded audio exceeds 200 MB; segment it first")
await voicebox_transcribe(audio_base64=audio_base64) Type guard
def decoded_audio_under_limit(value: str, limit: int = 200 * 1024 * 1024) -> bool:
import base64
try:
return len(base64.b64decode(value, validate=True)) <= limit
except Exception:
return False Try / catch
try:
await voicebox_transcribe(audio_base64=audio_base64)
except ValueError as exc:
if "exceeds" in str(exc) and "MB limit" in str(exc):
for chunk in segment_audio_bytes(raw, max_bytes=150 * 1024 * 1024):
await voicebox_transcribe(audio_base64=base64.b64encode(chunk).decode())
else:
raise Prevention
- Remember the limit applies to decoded bytes, not the base64 string length.
- For large local files, use audio_path (loopback) to avoid base64 overhead.
- Down-sample/segment long recordings before encoding.
When it happens
Trigger: Sending a base64-encoded clip whose decoded content is over 200 MB; base64 of a >150 MB binary will already approach the cap (base64 inflation is ~4/3).
Common situations: Long uncompressed audio shipped via base64; transport ceiling lower than the decode cap so the payload often fails earlier; client assuming the limit applies to the encoded size, not decoded.
Related errors
- File exceeds {MAX_TRANSCRIBE_BYTES // (1024 * 1024)} MB limi
- Invalid audio_base64: {exc}
- Pass exactly one of `audio_base64` or `audio_path`.
- `audio_path` is only available to loopback callers — remote
- `audio_path` must be absolute.
AI-assisted analysis of jamiepine/voicebox@51f49dea19 (2026-08-12).
Data as JSON: /api/errors/e9e04daee13e83eb.
Report an issue: GitHub.