jamiepine/voicebox · error · ValueError

File exceeds {MAX_TRANSCRIBE_BYTES // (1024 * 1024)} MB limi

Error message

File exceeds {MAX_TRANSCRIBE_BYTES // (1024 * 1024)} MB limit.

What it means

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.

Source

Thrown at backend/mcp_server/tools.py:149

                "Pass exactly one of `audio_base64` or `audio_path`."
            )

        # Absolute-path mode: validate and transcribe in place. Restricted
        # to loopback callers so a Voicebox bound on 0.0.0.0 doesn't double
        # as an unauthenticated arbitrary-local-file read primitive.
        if audio_path is not None:
            if not request_is_loopback():
                raise ValueError(
                    "`audio_path` is only available to loopback callers — "
                    "remote callers must use `audio_base64`."
                )
            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)

View on GitHub (pinned to 51f49dea19)

Solutions

  1. Trim or segment the audio into clips under 200 MB each and transcribe them separately.
  2. Re-encode to a more compact container/bitrate (e.g. 16 kHz mono FLAC/Opus) before submitting.
  3. For very long audio, drive a chunked transcription pipeline instead of one giant file.

Example fix

// before
voicebox_transcribe(audio_path="/tmp/4hour.wav")  // >200MB
// after
# split into 30-min segments, then
voicebox_transcribe(audio_path="/tmp/seg_001.wav")
Defensive patterns

Strategy: validation

Validate before calling

from backend.mcp_server.tools import MAX_TRANSCRIBE_BYTES
from pathlib import Path
size = Path(audio_path).stat().st_size
if size > MAX_TRANSCRIBE_BYTES:
    raise ValueError(f"{audio_path} is {size} bytes > {MAX_TRANSCRIBE_BYTES}")
await voicebox_transcribe(audio_path=audio_path)

Type guard

def audio_under_file_limit(value: str, limit: int = 200 * 1024 * 1024) -> bool:
    from pathlib import Path
    return Path(value).stat().st_size <= limit

Try / catch

try:
    await voicebox_transcribe(audio_path=audio_path)
except ValueError as exc:
    if "MB limit" in str(exc):
        # segment the file and transcribe each chunk
        for clip in segment_audio(audio_path, max_bytes=150 * 1024 * 1024):
            await voicebox_transcribe(audio_path=clip)
    else:
        raise

Prevention

When it happens

Trigger: Submitting an audio file larger than 200 MB via audio_path (e.g. a multi-hour recording, a lossless WAV instead of compressed audio).

Common situations: Long dictations exported as uncompressed PCM/WAV; concatenated sessions; forgetting that Whisper transcribes short clips rather than whole archives.

Related errors


AI-assisted analysis of jamiepine/voicebox@51f49dea19 (2026-08-12). Data as JSON: /api/errors/a6f48e64b1abe1a1. Report an issue: GitHub.