danny-avila/LibreChat · error

Missing data in response from the STT API

Error message

Missing data in response from the STT API

What it means

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.

Source

Thrown at api/server/services/Files/Audio/STTService.js:323

      audioReadStream,
      audioFile,
      language,
    );

    const options = { headers };

    applyAxiosProxyConfig(options, url);
    applySSRFSafeAgentIfDirect(options, url, allowedAddresses);

    try {
      const response = await axios.post(url, data, options);

      if (response.status !== 200) {
        throw new Error('Invalid response from the STT API');
      }

      if (!response.data || !response.data.text) {
        throw new Error('Missing data in response from the STT API');
      }

      return response.data.text.trim();
    } catch (error) {
      logAxiosError({ message: `STT request failed for provider ${provider}:`, error });
      throw error;
    }
  }

  /**
   * Processes a speech-to-text request.
   * @async
   * @param {Object} req - The request object.
   * @param {Object} res - The response object.
   * @returns {Promise<void>}
   */
  async processSpeechToText(req, res) {
    if (!req.file) {

View on GitHub (pinned to 5ff282f900)

Solutions

  1. Log response.data at the call site to see the actual body shape returned.
  2. Pin apiVersion to one documented to return { text }, or point the URL at an OpenAI-compatible STT endpoint.
  3. If the body legitimately returns empty text for silent audio, treat that as an empty transcript upstream rather than an error.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const text = await stt.sttRequest(provider, sttSchema, { audioBuffer, audioFile, language }, allowedAddresses);
} catch (err) {
  if (/Missing data in response/.test(err.message)) {
    log.error({ body: err.response?.data }, 'STT provider returned unexpected body shape');
    return res.status(502).json({ error: 'STT provider response shape unsupported' });
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of danny-avila/LibreChat@5ff282f900 (2026-08-12). Data as JSON: /api/errors/7efb566f7ae4397f. Report an issue: GitHub.