{"record":{"id":"aa278386777a924e","repo":"danny-avila/LibreChat","slug":"invalid-provider-aa2783","errorCode":null,"errorMessage":"Invalid provider","messagePattern":"Invalid provider","errorType":"exception","errorClass":null,"httpStatus":500,"severity":"error","filePath":"api/server/services/Files/Audio/getVoices.js","lineNumber":47,"sourceCode":"\n    const provider = await getProvider(appConfig);\n    let voices;\n\n    switch (provider) {\n      case TTSProviders.OPENAI:\n        voices = ttsSchema.openai?.voices;\n        break;\n      case TTSProviders.AZURE_OPENAI:\n        voices = ttsSchema.azureOpenAI?.voices;\n        break;\n      case TTSProviders.ELEVENLABS:\n        voices = ttsSchema.elevenlabs?.voices;\n        break;\n      case TTSProviders.LOCALAI:\n        voices = ttsSchema.localai?.voices;\n        break;\n      default:\n        throw new Error('Invalid provider');\n    }\n\n    res.json(voices);\n  } catch (error) {\n    res.status(500).json({ error: `Failed to get voices: ${error.message}` });\n  }\n}\n\nmodule.exports = getVoices;\n","sourceCodeStart":29,"sourceCodeEnd":57,"githubUrl":"https://github.com/danny-avila/LibreChat/blob/5ff282f9006c436e561de1afd39a481bea1ef0d8/api/server/services/Files/Audio/getVoices.js#L29-L57","documentation":"getVoices switch default branch: the provider string returned by TTSService.getProvider does not match any case constant (openai, azureOpenAI, elevenlabs, localai). This is hard to hit in normal operation because getProvider already validates exactly one provider exists, but it fires if the configured provider key value drifts from the TTSProviders constants used in the switch.","triggerScenarios":"speech.tts has one populated provider whose key is not one of the four supported constants (e.g. a renamed/cased value, or a future provider constant not yet added to the switch).","commonSituations":"librechat-data-provider TTSProviders constant value changed but the switch wasn't updated; hand-edited provider string with wrong casing; new provider added to data-provider before the switch caught up.","solutions":["Set the provider key in speech.tts to a value matching a TTSProviders constant exactly.","Upgrade librechat-data-provider and the API service in lockstep so constants and switch cases agree.","Confirm only one provider is populated so getProvider returns the intended one."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"const { TTSProviders } = require('librechat-data-provider');\nif (!Object.values(TTSProviders).includes(provider)) {\n  return res.status(500).json({ error: `Unsupported TTS provider: ${provider}` });\n}","typeGuard":"/** @param {string} p */\nfunction isValidTtsProvider(p) {\n  const { TTSProviders } = require('librechat-data-provider');\n  return Object.values(TTSProviders).includes(p);\n}","tryCatchPattern":null,"preventionTips":["Source provider names from TTSProviders constants so they always match the switch cases.","Upgrade librechat-data-provider and the API service in lockstep.","Add a default-case unit test covering unknown provider values."],"tags":["tts","provider","config","endpoint"],"backgroundTag":null,"analyzedSha":"5ff282f9006c436e561de1afd39a481bea1ef0d8","analyzedAt":"2026-08-12T21:38:08.145Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}