{"record":{"id":"e8d632b79a0b2dda","repo":"moeru-ai/airi","slug":"failed-to-initialize-transcription-provider-e8d632","errorCode":null,"errorMessage":"Failed to initialize transcription provider","messagePattern":"Failed to initialize transcription provider","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/stage-pages/src/pages/settings/providers/transcription/openai-compatible-audio-transcription.vue","lineNumber":79,"sourceCode":"})\n\n// Load models\nconst providerModels = computed(() => {\n  return providersStore.getModelsForProvider(providerId)\n})\n\nconst isLoadingModels = computed(() => {\n  return providersStore.isLoadingModels[providerId] || false\n})\n\n// Check if API key is configured\nconst apiKeyConfigured = computed(() => !!providers.value[providerId]?.apiKey)\n\n// Generate transcription\nasync function handleGenerateTranscription(file: File) {\n  const provider = await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)\n  if (!provider)\n    throw new Error('Failed to initialize transcription provider')\n\n  // Get provider configuration\n  const providerConfig = providerStore.getProviderConfig(providerId)\n\n  // Get model from configuration or use the reactive model value\n  const modelToUse = providerConfig.model as string | undefined || model.value\n\n  // Validate model - throw error if no valid model configured\n  if (!modelToUse || !isValidTranscriptionModel(modelToUse)) {\n    throw new Error(`Invalid or missing transcription model. Please configure a valid model in the provider settings.`)\n  }\n\n  return await hearingStore.transcription(\n    providerId,\n    provider,\n    modelToUse,\n    file,\n    'json',","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/stage-pages/src/pages/settings/providers/transcription/openai-compatible-audio-transcription.vue#L61-L97","documentation":"Same guard as the official OpenAI page, but in the openai-compatible transcription settings page: providersStore.getProviderInstance() returned null/undefined for the openai-compatible provider id before any transcription request was made. OpenAI-compatible endpoints need both a stored API key and (usually) a baseUrl; if either is missing or the provider id is unregistered, the factory declines to build an instance and this error is thrown.","triggerScenarios":"Clicking Generate Transcription when the openai-compatible provider has no saved API key, no baseUrl initialized (onMounted only sets the default when missing), or when providerId is not in the providers registry used by getProviderInstance.","commonSituations":"Using a self-hosted/OpenRouter/Groq-style endpoint but never saving credentials; persisted settings lost after storage reset; switching between stage apps where the provider store was initialized differently; typo'd or renamed providerId after refactoring the providers directory.","solutions":["Fill in API key and baseUrl for the openai-compatible provider in settings and save before generating.","Confirm the provider is initialized (onMounted calls initializeProvider(providerId)) and that getDefaultProviderConfig(providerId) returns a baseUrl.","Verify providerId matches the registered definition in packages/stage-ui/src/stores/providers.","Inspect earlier console output for a failed getProviderInstance cause (e.g. missing settings record)."],"exampleFix":"// before\nconst provider = await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)\nif (!provider)\n  throw new Error('Failed to initialize transcription provider')\n\n// after\nconst provider = await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)\nif (!provider)\n  throw new Error(`Failed to initialize transcription provider \"${providerId}\". Check that API key and base URL are saved in provider settings.`)","handlingStrategy":"validation","validationCode":"const ready = computed(() =>\n  !!providers.value[providerId]?.apiKey\n  && !!providers.value[providerId]?.baseUrl,\n)\nif (!ready.value) {\n  // disable generation UI until both fields are saved\n}","typeGuard":"function isOpenAICompatibleProviderReady(\n  settings: { apiKey?: string, baseUrl?: string } | undefined,\n): boolean {\n  return !!settings?.apiKey && !!settings?.baseUrl\n}","tryCatchPattern":"try {\n  await handleGenerateTranscription(file)\n}\ncatch (error) {\n  if (errorMessageFrom(error).includes('Failed to initialize transcription provider')) {\n    // treat as configuration problem: open provider settings, no auto-retry\n  }\n  throw error\n}","preventionTips":["Require API key and baseUrl in UI validation before enabling transcription.","Initialize baseUrl default on mount (the page already does this) and verify it persisted.","Keep providerId constants derived from the registry definition to avoid drift."],"tags":["provider-initialization","configuration","api-key","openai-compatible","transcription"],"backgroundTag":"provider-initialization-failed","analyzedSha":"677329427f32468c74b17f3ec47eeca4e05bec65","analyzedAt":"2026-08-18T17:29:58.153Z","contentChangedAt":"2026-08-18T17:29:58.153Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}