moeru-ai/airi · error
Failed to initialize transcription provider
Error message
Failed to initialize transcription provider
What it means
Thrown by the OpenAI audio transcription settings page when providersStore.getProviderInstance() resolves to a falsy value for the configured providerId. The provider factory in the stage-ui providers registry either could not find a registered provider definition for that id, or refused to construct an instance (for example because the API key was never persisted). It is a setup/dependency error, not a network error: nothing was sent to OpenAI yet.
Source
Thrown at packages/stage-pages/src/pages/settings/providers/transcription/openai-audio-transcription.vue:56
const isLoadingModels = computed(() => {
return providersStore.isLoadingModels[providerId] || false
})
// Check if API key is configured
const apiKeyConfigured = computed(() => !!providers.value[providerId]?.apiKey)
// Load models on mount
onMounted(async () => {
await providersStore.loadModelsForConfiguredProviders()
await providersStore.fetchModelsForProvider(providerId)
})
// Generate transcription
async function handleGenerateTranscription(file: File) {
const provider = await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)
if (!provider) {
throw new Error('Failed to initialize transcription provider')
}
// Get provider configuration
const providerConfig = providerStore.getProviderConfig(providerId)
// Get model from configuration or use default
const modelToUse = providerConfig.model as string | undefined || defaultModel
return await hearingStore.transcription(
providerId,
provider,
modelToUse,
file,
'json',
)
}
watch(model, async () => {View on GitHub (pinned to 677329427f)
Solutions
- Enter and save an API key for the provider in the settings page, then retry generation (apiKeyConfigured computed must be true).
- Verify providerId matches the key registered in packages/stage-ui/src/stores/providers.ts / stores/providers/ definitions.
- Check that onMounted's initializeProvider/fetchModels flow ran without errors (look for earlier console failures) before invoking generation.
- If importing a custom provider, confirm its factory is registered in the providers registry consumed by getProviderInstance.
Example fix
// before
const provider = await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)
if (!provider) {
throw new Error('Failed to initialize transcription provider')
}
// after — surface the actionable cause instead of a generic message
const provider = await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)
if (!provider) {
throw new Error(`Failed to initialize transcription provider "${providerId}". ${apiKeyConfigured.value ? 'Provider is not registered.' : 'Save an API key for this provider first.'}`)
} Defensive patterns
Strategy: validation
Validate before calling
const configured = computed(() => !!providers.value[providerId]?.apiKey)
if (!configured.value) {
// show 'save an API key first' UI instead of attempting generation
}
const provider = configured.value
? await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)
: null Type guard
function isTranscriptionProviderReady(
settings: { apiKey?: string } | undefined,
instance: unknown,
): instance is TranscriptionProviderWithExtraOptions<string, any> {
return !!settings?.apiKey && instance != null
} Try / catch
try {
await handleGenerateTranscription(file)
}
catch (error) {
if (errorMessageFrom(error).includes('Failed to initialize transcription provider')) {
// prompt user to complete provider settings; do not retry with same state
}
throw error
} Prevention
- Gate the Generate button on apiKeyConfigured so the provider factory is never invoked without credentials.
- Run initializeProvider(providerId) in onMounted before any generation is possible.
- Fail fast in provider registries with a specific reason when getProviderInstance returns null.
When it happens
Trigger: Calling handleGenerateTranscription (pressing Generate in the transcription settings page) while providers.value[providerId]?.apiKey is empty, the provider was never initialized via initializeProvider(providerId), or the provider id is not present in the registry consumed by getProviderInstance.
Common situations: User opens the transcription settings tab and clicks Generate before entering/saving an API key; localStorage/persisted provider settings were cleared; the providerId constant drifted out of sync with the registered provider key after a refactor; provider settings live in a different app (stage-web vs stage-tamagotchi) and were never configured there.
Related errors
- Failed to initialize transcription provider
- Failed to initialize transcription provider
- Failed to initialize transcription provider
- Invalid or missing transcription model. Please configure a v
- Provider credentials for ${providerId} not found
AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18).
Data as JSON: /api/errors/bec151a65689aef2.
Report an issue: GitHub.