moeru-ai/airi · error

Failed to initialize transcription provider

Error message

Failed to initialize transcription provider

What it means

Thrown by the MiMo audio transcription playground when `getProviderInstance` resolves falsy before transcription. The page loads models on mount; building the provider needs the persisted MiMo API key. The store's own missing-config/definition paths throw other messages, so this guard fires when the factory returns `undefined` — the runtime shape the non-nullable `Promise<R>` type does not model, classically caused by blank credentials.

Source

Thrown at packages/stage-pages/src/pages/settings/providers/transcription/mimo-audio-transcription.vue:70

    providers.value[providerId].model = value
  },
})

const apiKeyConfigured = computed(() => !!providers.value[providerId]?.apiKey)

const providerModels = computed(() => providersStore.getModelsForProvider(providerId))

const isLoadingModels = computed(() => providersStore.isLoadingModels[providerId] || false)

onMounted(async () => {
  await providersStore.loadModelsForConfiguredProviders()
  await providersStore.fetchModelsForProvider(providerId)
})

async function handleGenerateTranscription(file: File) {
  const provider = await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)
  if (!provider)
    throw new Error('Failed to initialize transcription provider')

  return await hearingStore.transcription(
    providerId,
    provider,
    model.value,
    file,
    'json',
  )
}

const {
  t,
  router,
  providerMetadata,
  isValidating,
  isValid,
  validationMessage,
  handleResetSettings,

View on GitHub (pinned to 677329427f)

Solutions

  1. Save a valid MiMo API key for the transcription provider entry and let validation pass.
  2. Reload the page after saving so the instance rebuilds.
  3. Inspect console for `Error creating provider instance for ...` for the decline reason.
  4. Verify the selected model comes from the fetched MiMo transcription model list.
  5. Report it if valid credentials still produce a falsy instance.

Example fix

// before
const provider = await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)
if (!provider)
  throw new Error('Failed to initialize transcription provider')

// after
const config = providerStore.getProviderConfig(providerId)
if (!config?.apiKey?.trim())
  throw new Error('MiMo API key is empty. Save it in provider settings first.')
const provider = await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)
if (!provider || typeof provider.transcription !== 'function')
  throw new Error('MiMo factory returned no usable instance — check config and console logs')
Defensive patterns

Strategy: validation

Validate before calling

const apiKeyConfigured = computed(() => !!providers.value[providerId]?.apiKey?.trim())
if (!apiKeyConfigured.value)
  throw new Error('Save a MiMo API key before transcribing')

Type guard

function isTranscriptionProvider(v: unknown): v is TranscriptionProviderWithExtraOptions<string, any> {
  return typeof v === 'object' && v !== null && typeof (v as TranscriptionProviderWithExtraOptions<string, any>).transcription === 'function'
}

Try / catch

try { return await hearingStore.transcription(providerId, provider, model.value, file, 'json') }
catch (error) { showError(errorMessageFrom(error)) }

Prevention

When it happens

Trigger: Clicking transcribe before saving the MiMo API key; a whitespace/empty key persisted; transcribing before the onMounted model fetch completes while no credentials exist.

Common situations: Key entered for MiMo speech but not the transcription entry (separate config slots); clearing and saving the key to troubleshoot; expired keys re-entered without saving; skipping validation with force.

Related errors


AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18). Data as JSON: /api/errors/14d8f8e25b411a76. Report an issue: GitHub.