{"record":{"id":"0526f0b110a9932d","repo":"Mintplex-Labs/anything-llm","slug":"deepgram-transcription-failed-error-message","errorCode":null,"errorMessage":"Deepgram transcription failed - ${error.message}","messagePattern":"Deepgram transcription failed - (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/SpeechToText/deepgram/index.js","lineNumber":74,"sourceCode":"      body: audioBuffer,\n    })\n      .then(async (response) => {\n        if (!response.ok) {\n          const errBody = await response.text().catch(() => \"\");\n          throw new Error(\n            `Deepgram transcription failed (${response.status}) - ${errBody}`\n          );\n        }\n        return response.json();\n      })\n      .then((result) => {\n        return (\n          result?.results?.channels?.[0]?.alternatives?.[0]?.transcript ?? \"\"\n        );\n      })\n      .catch((error) => {\n        this.#log(`Deepgram transcription failed - ${error.message}`);\n        throw new Error(`Deepgram transcription failed - ${error.message}`);\n      });\n  }\n}\n\nmodule.exports = { DeepgramSTT };\n","sourceCodeStart":56,"sourceCodeEnd":80,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/SpeechToText/deepgram/index.js#L56-L80","documentation":"This is the .catch at the end of the Deepgram fetch chain: any error thrown earlier — network failures (DNS, ECONNREFUSED, TLS), body-read/JSON-parse failures, or the non-ok status error itself — is logged and re-thrown wrapped in this generic prefix. Because the inner status error passes through the same catch, its message text is duplicated inside this one.","triggerScenarios":"fetch cannot reach api.deepgram.com (offline, DNS failure, firewall/proxy blocking, TLS interception); response.text()/json() throws on a malformed body; or a wrapped re-throw of the HTTP-status error from the previous stage, recognizable by the '(status) - body' suffix inside the message.","commonSituations":"Self-hosted/Docker deployments without outbound internet; corporate proxies requiring custom CA or HTTP_PROXY settings; transient network blips mid-upload; reading the message without realizing it nests the original status error text.","solutions":["Check for a nested '(status) - body' suffix — if present, treat it as the API-status case (fix key/model per that status) rather than a network fault","Verify outbound connectivity: curl -H 'Authorization: Token <key>' 'https://api.deepgram.com/v1/listen' from the same host/container","Configure proxy/TLS env (HTTPS_PROXY, NODE_EXTRA_CA_CERTS) when a corporate network intercepts traffic","Add a retry with backoff for transient network failures before surfacing the error"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Fail fast on obvious connectivity problems before calling Deepgram\nawait fetch('https://api.deepgram.com/v1/listen', { method: 'HEAD' }).catch(() => {\n  throw new Error('api.deepgram.com is unreachable from this host');\n});","typeGuard":null,"tryCatchPattern":"let lastErr;\nfor (let attempt = 0; attempt < 3; attempt++) {\n  try { return await stt.process(audioBuffer, filename); }\n  catch (err) {\n    lastErr = err;\n    if (/\\((4|5)\\d\\d\\)/.test(err.message)) throw err; // wrapped API-status error: not a network fault\n    await sleep(2 ** attempt * 500); // DNS/ECONNREFUSED/TLS: retry with backoff\n  }\n}\nthrow lastErr;","preventionTips":["Distinguish nested status errors from network faults by checking for the '(status)' pattern before retrying","Configure proxy and CA env vars (HTTPS_PROXY, NODE_EXTRA_CA_CERTS) in restricted networks","Add a request timeout so hung connections fail into the catch quickly"],"tags":["deepgram","speech-to-text","network-error","error-wrapping"],"backgroundTag":"fetch-network-error","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}