danny-avila/LibreChat · warning
Voice ${voice} is not available.
Error message
Voice ${voice} is not available. What it means
openAIProvider rejects a voice that is not in ttsSchema.voices, unless the list contains the sentinel 'ALL'. The check only runs when `voices` is a non-empty array, so an unset/empty voices list disables the allowlist (any voice passes). A configured list thus acts as a strict gate.
Source
Thrown at api/server/services/Files/Audio/TTSService.js:119
/**
* Prepares the request for OpenAI TTS provider.
* @param {Object} ttsSchema - The TTS schema for OpenAI.
* @param {string} input - The input text.
* @param {string} voice - The selected voice.
* @returns {Array} An array containing the URL, data, and headers for the request.
* @throws {Error} If the selected voice is not available.
*/
openAIProvider(ttsSchema, input, voice) {
const url = ttsSchema?.url || 'https://api.openai.com/v1/audio/speech';
if (
ttsSchema?.voices &&
ttsSchema.voices.length > 0 &&
!ttsSchema.voices.includes(voice) &&
!ttsSchema.voices.includes('ALL')
) {
throw new Error(`Voice ${voice} is not available.`);
}
const data = {
input,
model: ttsSchema?.model,
voice: ttsSchema?.voices && ttsSchema.voices.length > 0 ? voice : undefined,
backend: ttsSchema?.backend,
};
const apiKey = resolveConfigSecret(ttsSchema?.apiKey) || '';
const headers = {
'Content-Type': 'application/json',
...(apiKey && { Authorization: `Bearer ${apiKey}` }),
};
return [url, data, headers];
}
View on GitHub (pinned to 5ff282f900)
Solutions
- Use a voice id returned by GET /api/voices for the current provider.
- Add the desired voice id to ttsSchema.openai.voices in librechat.yaml.
- If you want to allow any voice, include 'ALL' in the voices list (or leave voices unset).
Example fix
# before
speech:
tts:
openai:
voices: ['alloy', 'echo']
# request uses voice='nova' -> error
# after
speech:
tts:
openai:
voices: ['alloy', 'echo', 'nova'] Defensive patterns
Strategy: validation
Validate before calling
const allowed = ttsSchema?.voices;
if (Array.isArray(allowed) && allowed.length > 0 && !allowed.includes(voice) && !allowed.includes('ALL')) {
return res.status(400).json({ error: `Voice ${voice} is not in the allowed list.` });
} Prevention
- Fetch the voice list from GET /api/voices and only offer ids it returns.
- Include 'ALL' in voices (or leave voices unset) to disable the allowlist when not needed.
- Re-fetch voices after config changes.
When it happens
Trigger: POST /api/speech/tts with the openai provider and a voice id not present in ttsSchema.openai.voices (and the list does not include 'ALL').
Common situations: Frontend cached an older voice list; config voices changed; voice id typo; user-supplied voice not in the allowlist.
Related errors
- Text is required
- Missing DALLE_API_KEY environment variable.
- Missing required field: prompt
- Missing required field: prompt
- Missing required field: finetune_id for finetuned generation
AI-assisted analysis of danny-avila/LibreChat@5ff282f900 (2026-08-12).
Data as JSON: /api/errors/39513a627957f240.
Report an issue: GitHub.