danny-avila/LibreChat · error
Invalid provider
Error message
Invalid provider
What it means
ttsRequest looks up this.providerStrategies[provider]; if the provider string is not a registered strategy key (openai, azureOpenAI, elevenlabs, localai) it throws synchronously before forming the request. This prevents dispatching to an unimplemented strategy.
Source
Thrown at api/server/services/Files/Audio/TTSService.js:266
}
/**
* Sends a TTS request to the specified provider.
* @async
* @param {string} provider - The TTS provider to use.
* @param {Object} ttsSchema - The TTS schema for the provider.
* @param {Object} options - The options for the TTS request.
* @param {string} options.input - The input text.
* @param {string} options.voice - The voice to use.
* @param {boolean} [options.stream=true] - Whether to use streaming.
* @param {string[]} [allowedAddresses] - Section-level SSRF exemption list of host:port pairs.
* @returns {Promise<Object>} The axios response object.
* @throws {Error} If the provider is invalid or the request fails.
*/
async ttsRequest(provider, ttsSchema, { input, voice, stream = true }, allowedAddresses) {
const strategy = this.providerStrategies[provider];
if (!strategy) {
throw new Error('Invalid provider');
}
const [url, data, headers] = strategy.call(this, ttsSchema, input, voice, stream);
[data, headers].forEach(this.removeUndefined.bind(this));
const options = { headers, responseType: stream ? 'stream' : 'arraybuffer' };
applyAxiosProxyConfig(options, url);
applySSRFSafeAgentIfDirect(options, url, allowedAddresses);
try {
return await axios.post(url, data, options);
} catch (error) {
logAxiosError({ message: `TTS request failed for provider ${provider}:`, error });
throw error;
}
}View on GitHub (pinned to 5ff282f900)
Solutions
- Ensure the `speech.tts` provider key matches a supported TTSProviders constant exactly.
- Confirm only one provider is configured so getProvider returns the right one.
- Upgrade librechat-data-provider and the API service together so constant values and strategy keys agree.
Defensive patterns
Strategy: type-guard
Validate before calling
const { TTSProviders } = require('librechat-data-provider');
if (!Object.values(TTSProviders).includes(provider)) {
throw new Error(`Unknown TTS provider: ${provider}`);
} Type guard
/** @param {string} p */
function isValidTtsProvider(p) {
const { TTSProviders } = require('librechat-data-provider');
return Object.values(TTSProviders).includes(p);
} Prevention
- Source provider names from TTSProviders constants, never literals.
- Upgrade librechat-data-provider and the API service together.
- Assert at startup that every providerStrategies key maps to a known constant.
When it happens
Trigger: The provider returned by getProvider (or passed directly) does not match a key in providerStrategies — e.g. casing mismatch, a constant value that drifted, or a provider configured with no strategy.
Common situations: librechat-data-provider TTSProviders constant changed value and the service wasn't updated; config hand-edited with a wrong provider string; new provider referenced before its strategy was implemented.
Related errors
- Invalid provider
- Multiple providers are set. Please set only one provider.
- No provider is set. Please set a provider.
- Invalid provider
- Multiple providers are set. Please set only one provider.
AI-assisted analysis of danny-avila/LibreChat@5ff282f900 (2026-08-12).
Data as JSON: /api/errors/2e91f4bababdae65.
Report an issue: GitHub.