iOfficeAI/AionUi · warning
STT_FILE_TOO_LARGE
STT_FILE_TOO_LARGE
Error message
STT_FILE_TOO_LARGE
What it means
Before uploading a recorded blob for speech-to-text, `ensureAudioSize` enforces `MAX_AUDIO_FILE_SIZE_BYTES`. The error code `STT_FILE_TOO_LARGE` signals the client-side recording exceeds the upload cap, avoiding a doomed network request.
Source
Thrown at packages/desktop/src/renderer/services/SpeechToTextService.ts:40
return 'mp3';
case 'audio/ogg':
case 'audio/ogg;codecs=opus':
return 'ogg';
case 'audio/wav':
case 'audio/wave':
return 'wav';
default:
return 'webm';
}
};
const createAudioFileName = (mimeType: string) => {
return `speech-input.${getAudioExtension(mimeType)}`;
};
const ensureAudioSize = (blob: Blob) => {
if (blob.size > MAX_AUDIO_FILE_SIZE_BYTES) {
throw new Error('STT_FILE_TOO_LARGE');
}
};
const parseSuccessResponse = (response: XMLHttpRequest): SpeechToTextResult => {
const payload = JSON.parse(response.responseText) as {
data?: SpeechToTextResult;
msg?: string;
success: boolean;
};
if (!payload.success || !payload.data) {
throw new Error(payload.msg || 'STT_REQUEST_FAILED');
}
return payload.data;
};
// Surface the backend error code (STT_DISABLED, STT_OPENAI_NOT_CONFIGURED, ...)View on GitHub (pinned to 711aa0550e)
Solutions
- Shorten the recording or stop recording earlier (enforce a max duration in the recorder UI)
- Prefer compressed mime types (audio/webm;codecs=opus) over uncompressed WAV/PCM to shrink blob size
- Check/raise MAX_AUDIO_FILE_SIZE_BYTES if the backend actually supports larger uploads
- Show a live size/duration indicator and stop automatically near the cap
Example fix
// before
const ensureAudioSize = (blob: Blob) => {
if (blob.size > MAX_AUDIO_FILE_SIZE_BYTES) {
throw new Error('STT_FILE_TOO_LARGE');
}
};
// after (stop recording before exceeding the cap)
if (recorder && elapsedBytesRef.current >= MAX_AUDIO_FILE_SIZE_BYTES) recorder.stop(); Defensive patterns
Strategy: validation
Validate before calling
if (blob.size > MAX_AUDIO_FILE_SIZE_BYTES) { /* warn user, refuse upload */ } Type guard
const isAudioSizeOk = (blob: Blob): boolean => blob.size <= MAX_AUDIO_FILE_SIZE_BYTES;
Try / catch
catch (e) { if (e.message === 'STT_FILE_TOO_LARGE') toast.warning(t('speech.fileTooLarge')); } Prevention
- Cap recording duration in the recorder UI
- Prefer compressed codecs (opus/webm) over WAV
When it happens
Trigger: Calling `transcribeAudioBlob` with a Blob whose `size` exceeds MAX_AUDIO_FILE_SIZE_BYTES — typically a long dictation recording, or a high-bitrate audio mimeType producing large payloads.
Common situations: Users recording very long voice messages; browsers producing large WAV/PCM blobs (uncompressed) versus compact webm/opus; the cap being lowered without adjusting UX to warn about recording length.
Related errors
AI-assisted analysis of iOfficeAI/AionUi@711aa0550e (2026-08-28).
Data as JSON: /api/errors/4da0a54faaa509a4.
Report an issue: GitHub.