{"record":{"id":"7efb566f7ae4397f","repo":"danny-avila/LibreChat","slug":"missing-data-in-response-from-the-stt-api","errorCode":null,"errorMessage":"Missing data in response from the STT API","messagePattern":"Missing data in response from the STT API","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/server/services/Files/Audio/STTService.js","lineNumber":323,"sourceCode":"      audioReadStream,\n      audioFile,\n      language,\n    );\n\n    const options = { headers };\n\n    applyAxiosProxyConfig(options, url);\n    applySSRFSafeAgentIfDirect(options, url, allowedAddresses);\n\n    try {\n      const response = await axios.post(url, data, options);\n\n      if (response.status !== 200) {\n        throw new Error('Invalid response from the STT API');\n      }\n\n      if (!response.data || !response.data.text) {\n        throw new Error('Missing data in response from the STT API');\n      }\n\n      return response.data.text.trim();\n    } catch (error) {\n      logAxiosError({ message: `STT request failed for provider ${provider}:`, error });\n      throw error;\n    }\n  }\n\n  /**\n   * Processes a speech-to-text request.\n   * @async\n   * @param {Object} req - The request object.\n   * @param {Object} res - The response object.\n   * @returns {Promise<void>}\n   */\n  async processSpeechToText(req, res) {\n    if (!req.file) {","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/danny-avila/LibreChat/blob/5ff282f9006c436e561de1afd39a481bea1ef0d8/api/server/services/Files/Audio/STTService.js#L305-L341","documentation":"status is 200 but response.data or response.data.text is falsy — the provider returned a 2xx body that does not conform to the expected { text: string } shape. The service only knows how to read `.text`, so any other envelope (array of segments, JSON:API, error-shaped 200) is treated as missing data.","triggerScenarios":"The STT endpoint returns 200 with a body lacking a top-level `text` field — e.g. an array of segment objects, `{ result: {...} }`, or `{ text: '' }` for silent/unparseable audio.","commonSituations":"Provider API version change that altered the response schema; a non-OpenAI-compatible backend behind the configured URL; silent audio yielding an empty text field.","solutions":["Log response.data at the call site to see the actual body shape returned.","Pin apiVersion to one documented to return { text }, or point the URL at an OpenAI-compatible STT endpoint.","If the body legitimately returns empty text for silent audio, treat that as an empty transcript upstream rather than an error."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const text = await stt.sttRequest(provider, sttSchema, { audioBuffer, audioFile, language }, allowedAddresses);\n} catch (err) {\n  if (/Missing data in response/.test(err.message)) {\n    log.error({ body: err.response?.data }, 'STT provider returned unexpected body shape');\n    return res.status(502).json({ error: 'STT provider response shape unsupported' });\n  }\n  throw err;\n}","preventionTips":["Pin the STT apiVersion to one documented to return { text }.","Point the URL only at OpenAI-compatible STT endpoints.","Log response.data on shape failures so the real body is diagnosable."],"tags":["stt","response-shape","upstream","schema"],"backgroundTag":null,"analyzedSha":"5ff282f9006c436e561de1afd39a481bea1ef0d8","analyzedAt":"2026-08-12T21:38:08.145Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}