{"record":{"id":"a80a4785d7c5148f","repo":"moeru-ai/airi","slug":"failed-to-initialize-transcription-provider","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/comet-api-transcription.vue","lineNumber":65,"sourceCode":"})\n\nconst model = computed({\n  get: () => providers.value[providerId]?.model || '',\n  set: (value) => {\n    if (!providers.value[providerId])\n      providers.value[providerId] = {}\n    providers.value[providerId].model = value\n  },\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  return await hearingStore.transcription(\n    providerId,\n    provider,\n    model.value,\n    file,\n    'json',\n  )\n}\n\n// Use the composable to get validation logic and state\nconst {\n  t,\n  router,\n  providerMetadata,\n  isValidating,\n  isValid,\n  validationMessage,","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/stage-pages/src/pages/settings/providers/transcription/comet-api-transcription.vue#L47-L83","documentation":"Thrown by the Comet API transcription playground when `getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)` resolves falsy before calling `hearingStore.transcription`. The store throws distinct errors when the definition or the whole config object is missing, so this branch means the Comet factory built nothing from the saved config — typically a blank/whitespace API key — despite `createProvider` being typed to return a non-nullable instance.","triggerScenarios":"Uploading a file and clicking transcribe before the Comet API key is saved; the key stored as an empty string (config object exists, so the store does not throw); generating while the model computed still holds no usable value and credentials were never completed.","commonSituations":"Using a Comet API key from a different workspace; key revoked or expired and the field cleared; onboarding skipped with 'force valid'; multiple OpenAI-compatible entries with the key saved in another provider's slot.","solutions":["Save a valid Comet API key in Settings → Providers → Comet API transcription and pass the config validator.","Reload the playground after saving so `getProviderInstance` rebuilds the instance.","Check console for `Error creating provider instance for ...` for the factory's underlying reason.","Confirm the model selector holds a transcription model from the fetched list.","Report persistent falsy results with valid credentials as a factory contract bug."],"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 config = providerStore.getProviderConfig(providerId)\nif (!config?.apiKey?.trim())\n  throw new Error('Comet API key is empty. Save it in provider settings first.')\nconst provider = await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)\nif (!provider || typeof provider.transcription !== 'function')\n  throw new Error('Comet API factory returned no usable instance — check config and console logs')","handlingStrategy":"validation","validationCode":"const apiKeyConfigured = computed(() => !!providers.value[providerId]?.apiKey?.trim())\nif (!apiKeyConfigured.value)\n  throw new Error('Save a Comet API key before transcribing')","typeGuard":"function isTranscriptionProvider(v: unknown): v is TranscriptionProviderWithExtraOptions<string, any> {\n  return typeof v === 'object' && v !== null && typeof (v as TranscriptionProviderWithExtraOptions<string, any>).transcription === 'function'\n}","tryCatchPattern":"try { return await hearingStore.transcription(providerId, provider, model.value, file, 'json') }\ncatch (error) { showError(errorMessageFrom(error)) }","preventionTips":["Save and validate the API key before uploading files.","Ensure a transcription model is selected from the fetched list.","Reload the page after credential updates."],"tags":["transcription","provider","initialization","api-key","comet-api"],"backgroundTag":"provider-instance-undefined","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"}