danny-avila/LibreChat · error

Configuration or TTS schema is missing

Error message

Configuration or TTS schema is missing

What it means

The getVoices endpoint guard: after resolving appConfig it checks appConfig.speech.tts and throws this distinct message before delegating to TTSService.getProvider. It exists so the endpoint can return a 500 with a clear cause rather than the underlying 'No TTS schema' text. Same root cause as the TTSService schema-missing error but surfaced at the route layer.

Source

Thrown at api/server/services/Files/Audio/getVoices.js:27

 *
 * @param {Object} req - The request object
 * @param {Object} res - The response object
 * @returns {Promise<void>}
 * @throws {Error} - If the provider is not 'openai' or 'elevenlabs', an error is thrown
 */
async function getVoices(req, res) {
  try {
    const appConfig =
      req.config ??
      (await getAppConfig({
        role: req.user?.role,
        userId: req.user?.id,
        tenantId: req.user?.tenantId,
      }));

    const ttsSchema = appConfig?.speech?.tts;
    if (!ttsSchema) {
      throw new Error('Configuration or TTS schema is missing');
    }

    const provider = await getProvider(appConfig);
    let voices;

    switch (provider) {
      case TTSProviders.OPENAI:
        voices = ttsSchema.openai?.voices;
        break;
      case TTSProviders.AZURE_OPENAI:
        voices = ttsSchema.azureOpenAI?.voices;
        break;
      case TTSProviders.ELEVENLABS:
        voices = ttsSchema.elevenlabs?.voices;
        break;
      case TTSProviders.LOCALAI:
        voices = ttsSchema.localai?.voices;
        break;

View on GitHub (pinned to 5ff282f900)

Solutions

  1. Configure a `speech.tts` block with one populated provider in librechat.yaml.
  2. Verify the config file is mounted and loaded (startup log).
  3. Restart the API server; re-request /api/voices.

Example fix

# before
speech: {}

# after
speech:
  tts:
    openai:
      apiKey: '${TTS_API_KEY}'
      voices: ['alloy', 'echo']
Defensive patterns

Strategy: validation

Validate before calling

const tts = appConfig?.speech?.tts;
if (!tts) {
  return res.status(503).json({ error: 'TTS is not configured on this server.' });
}

Type guard

/** @param {unknown} c */
function hasTtsSchema(c) {
  return !!c && typeof c === 'object' && 'speech' in c
    && !!c.speech && typeof c.speech === 'object'
    && 'tts' in c.speech && !!c.speech.tts && typeof c.speech.tts === 'object';
}

Prevention

When it happens

Trigger: GET /api/voices when librechat.yaml has no `speech.tts` section, or role/tenant-scoped config returns an object whose `speech.tts` is falsy.

Common situations: Client renders a voice picker before any TTS provider is configured; librechat.yaml not mounted; tenant override returns empty speech.

Related errors


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