{"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/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/SpeechToText/deepgram/index.js#L56-L80","documentation":"The outer .catch wrapper around the entire Deepgram transcribe promise chain. It logs the failure and re-throws a generic 'Deepgram transcription failed - <message>' error. Because the inner !response.ok branch (error 367) throws and then this catch re-wraps it, a failed HTTP request surfaces here as a nested message. It also catches network/JSON-parse errors that never produced a response.","triggerScenarios":"Any unhandled rejection inside transcribe: a network/DNS failure reaching api.deepgram.com, a malformed JSON response, or the re-thrown HTTP error from the inner check. The caller sees this flattened message.","commonSituations":"Container has no outbound internet; corporate proxy/firewall blocking api.deepgram.com; transient network blip; response.ok was true but body was not JSON.","solutions":["If the inner message contains an HTTP status, follow the fix for error 367.","If the message is a network error (fetch failed / ECONNREFUSED / ENOTFOUND), check container egress, DNS, and proxy settings.","Add retry with exponential backoff for transient failures before surfacing to the user.","Verify outbound connectivity: curl -I https://api.deepgram.com from the host/container."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Network reachability check before transcription.\nconst ok = await fetch(\"https://api.deepgram.com\", { method: \"HEAD\" })\n  .then(() => true)\n  .catch(() => false);\nif (!ok) throw new Error(\"Cannot reach api.deepgram.com from this host.\");","typeGuard":null,"tryCatchPattern":"try {\n  return await deepgram.transcribe(audioBuffer, filename);\n} catch (e) {\n  logger.error(\"Deepgram STT failed:\", e.message);\n  // optionally fall back to another STT provider here\n  throw e;\n}","preventionTips":["Ensure container egress to api.deepgram.com is allowed (firewall/proxy).","Wrap transcription in retry for transient network errors.","Distinguish status-code errors (367) from network errors to choose retry vs. fix."],"tags":["stt","deepgram","network","error-handling"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}