moeru-ai/airi · error · Error
Failed to initialize speech provider
Error message
Failed to initialize speech provider
What it means
Thrown by the IndexTTS-vLLM playground when the provider factory resolves falsy. IndexTTS-vLLM is a self-hosted provider: its definition builds an instance aimed at a user-provided vLLM server baseUrl rather than a cloud API key. `getProviderInstance` only throws its own errors when the definition or the whole config is missing; reaching this guard means `createProvider(config)` returned undefined, in practice because the endpoint configuration is blank or malformed.
Source
Thrown at packages/stage-pages/src/pages/settings/providers/speech/index-tts-vllm.vue:45
const apiKeyConfigured = true // Assuming API key is always configured as its not required
// Get available voices for Index TTS provider
const availableVoices = computed(() => {
return speechStore.availableVoices[providerId] || []
})
onMounted(async () => {
await speechStore.loadVoicesForProvider(providerId)
})
watch([apiKeyConfigured], async () => {
await speechStore.loadVoicesForProvider(providerId)
})
async function handleGenerateSpeech(input: string, voiceId: string) {
const provider = await providersStore.getProviderInstance(providerId) as SpeechProvider
if (!provider) {
throw new Error('Failed to initialize speech provider')
}
// Get provider configuration
const providerConfig = providerStore.getProviderConfig(providerId)
// Get model from configuration or use default
const model = providerConfig.model as string | undefined || defaultModel
const options = {
...providerConfig,
}
return await speechStore.speech(
provider,
model,
input,
voiceId,
options,View on GitHub (pinned to 677329427f)
Solutions
- Start the IndexTTS vLLM server and save its full base URL (scheme + host + port) in the provider settings.
- Verify the endpoint with a direct request (e.g. models list) before returning to the playground.
- Reload the page after saving so `getProviderInstance` rebuilds from fresh config.
- Check console for `Error creating provider instance for ...` with the factory's underlying reason.
- Report a bug if a reachable, fully-configured endpoint still produces a falsy instance.
Example fix
// before
const provider = await providersStore.getProviderInstance(providerId) as SpeechProvider
if (!provider)
throw new Error('Failed to initialize speech provider')
// after
const config = providerStore.getProviderConfig(providerId)
if (!config?.baseUrl?.trim())
throw new Error('IndexTTS vLLM base URL is empty. Start the server and save its URL first.')
const provider = await providersStore.getProviderInstance(providerId) as SpeechProvider
if (!provider || typeof provider.speech !== 'function')
throw new Error('IndexTTS vLLM factory returned no usable instance — check baseUrl and console logs') Defensive patterns
Strategy: validation
Validate before calling
const endpointConfigured = computed(() => {
const url = providers.value[providerId]?.baseUrl?.trim() ?? ''
return /^https?:\/\//.test(url)
})
if (!endpointConfigured.value)
throw new Error('Start the IndexTTS vLLM server and save its base URL first') Type guard
function isSpeechProvider(v: unknown): v is SpeechProvider {
return typeof v === 'object' && v !== null && typeof (v as SpeechProvider).speech === 'function'
} Try / catch
try { const provider = await providersStore.getProviderInstance(providerId) }
catch (error) { showError(errorMessageFrom(error)) } Prevention
- Health-check the vLLM endpoint (models list) before synthesis.
- Save the full URL including scheme and port.
- Never leave baseUrl as an empty string when saving the provider.
When it happens
Trigger: Clicking Generate before saving the vLLM server URL; baseUrl saved as empty string (the onMounted `??=` defaults elsewhere intentionally keep empty strings); pointing at a URL the factory refuses (missing scheme, wrong path) so it declines instead of constructing a client.
Common situations: Local vLLM/IndexTTS server not started yet or moved to another port; URL pasted without `http://`; switching between remote and local deployments and leaving the field blank; assuming the provider needs no config because it is local.
Related errors
- Failed to initialize speech provider
- Failed to fetch voices: ${response.statusText}
- Failed to initialize speech provider
- Failed to initialize speech provider
- Failed to initialize speech provider
AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18).
Data as JSON: /api/errors/96ac1e52f2cb575e.
Report an issue: GitHub.