Mintplex-Labs/anything-llm · error · Error
Deepgram transcription failed (${response.status}) - ${errBo
Error message
Deepgram transcription failed (${response.status}) - ${errBody} What it means
Thrown when the Deepgram pre-recorded REST API returns a non-OK HTTP status. The response status code and best-effort body text are embedded in the message. This wraps Deepgram-side failures: authentication, bad request, quota, rate limit, or server errors. The error is re-thrown after logging.
Source
Thrown at server/utils/SpeechToText/deepgram/index.js:61
* @returns {Promise<string>} The transcribed text.
*/
async transcribe(audioBuffer, filename = "audio.webm") {
const url = new URL(this.endpoint);
url.searchParams.set("model", this.model);
url.searchParams.set("smart_format", "true");
return await fetch(url.toString(), {
method: "POST",
headers: {
Authorization: `Token ${this.apiKey}`,
"Content-Type": this.#contentTypeFromFilename(filename),
},
body: audioBuffer,
})
.then(async (response) => {
if (!response.ok) {
const errBody = await response.text().catch(() => "");
throw new Error(
`Deepgram transcription failed (${response.status}) - ${errBody}`
);
}
return response.json();
})
.then((result) => {
return (
result?.results?.channels?.[0]?.alternatives?.[0]?.transcript ?? ""
);
})
.catch((error) => {
this.#log(`Deepgram transcription failed - ${error.message}`);
throw new Error(`Deepgram transcription failed - ${error.message}`);
});
}
}
module.exports = { DeepgramSTT };View on GitHub (pinned to 526360e320)
Solutions
- Match the HTTP status: 401/403 → regenerate STT_DEEPGRAM_API_KEY; 400 → check STT_DEEPGRAM_MODEL and audio format; 402 → check billing; 429 → back off; 5xx → retry shortly.
- Read errBody in the message — Deepgram returns a JSON reason string that pinpoints the problem.
- Confirm STT_DEEPGRAM_MODEL is a valid model id for your Deepgram account tier.
- Ensure the audio buffer is non-empty and a supported codec; convert to WAV via the helpers if unsure.
- Check Deepgram status page for ongoing incidents.
Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight the key/model cheaply is not possible; validate config shape instead.
if (!process.env.STT_DEEPGRAM_API_KEY) {
throw new Error("STT_DEEPGRAM_API_KEY is required for Deepgram STT.");
} Try / catch
async function transcribeWithRetry(stt, buf, name, attempts = 2) {
for (let i = 0; i < attempts; i++) {
try {
return await stt.transcribe(buf, name);
} catch (e) {
const m = e.message || "";
const retriable = /\(429\)|\(5\d{2}\)/.test(m);
if (!retriable || i === attempts - 1) throw e;
await new Promise((r) => setTimeout(r, 500 * Math.pow(2, i)));
}
}
} Prevention
- Keep STT_DEEPGRAM_API_KEY current; monitor for 401s and alert.
- Use a valid STT_DEEPGRAM_MODEL for your account tier (default nova-3).
- Convert audio to a supported codec before sending.
- Implement retry with backoff for 429/5xx only — never for 400/401/402.
When it happens
Trigger: 401/403 from an invalid or expired STT_DEEPGRAM_API_KEY; 400 from an invalid STT_DEEPGRAM_MODEL (e.g. a typo) or an audio container Deepgram cannot parse; 402 account out of credits; 429 rate limit; 5xx Deepgram outage.
Common situations: Wrong/revoked API key; mistyped model name (nova-3 vs nova-2); sending an audio format not in the Content-Type map (defaults to audio/webm); burst of requests hitting rate limits; Deepgram incident.
Related errors
- Deepgram transcription failed - ${error.message}
- HTTP ${res.status}: ${res.statusText}
- res.statusText || "Error generating api key."
- res.statusText || "Error finding custom models."
- AnthropicLLM::getChatCompletion failed to communicate with A
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/f85aeaee4c1acc5d.
Report an issue: GitHub.