moeru-ai/airi · error
Failed to initialize Aliyun NLS provider.
Error message
Failed to initialize Aliyun NLS provider.
What it means
Thrown by the Aliyun NLS streaming-transcription playground when `getProviderInstance('aliyun-nls-transcription')` resolves falsy before starting a realtime session. The Aliyun definition requires accessKeyId, accessKeySecret, and appKey (plus a region enum, default 'cn-shanghai'); its own factory throws 'Aliyun NLS credentials are incomplete.' for blank fields, and the store throws separately for missing config/definition — so this message catches the residual case where an instance still comes back null/undefined (factory or bridge regression, or a config shape that bypasses the explicit checks).
Source
Thrown at packages/stage-pages/src/pages/settings/providers/transcription/aliyun-nls-transcription.vue:228
errorMessage.value = null
resetTranscriptionOutput()
const abortController = new AbortController()
transcriptionAbortController.value = abortController
const audioStream = new ReadableStream<ArrayBuffer>({
start(controller) {
audioStreamController.value = controller
},
cancel: () => {
audioStreamController.value = undefined
},
})
try {
const provider = await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)
if (!provider)
throw new Error('Failed to initialize Aliyun NLS provider.')
const result = await hearingStore.transcription(
providerId,
provider,
defaultModel,
{ inputAudioStream: audioStream },
undefined,
{
providerOptions: {
abortSignal: abortController.signal,
hooks: {
onServerEvent: (event: ServerEvent) => {
handleServerEvent(event)
},
},
onSessionTerminated: async (error?: unknown) => {
if (error)
errorMessage.value = errorMessageFromValue(error)View on GitHub (pinned to 677329427f)
Solutions
- Fill all three credentials (Access Key ID, Access Key Secret, App Key) in the provider settings — the built-in validator flags each missing one.
- Pick a supported region from the enum (e.g. cn-shanghai, cn-beijing, cn-shenzhen) — use non-internal variants from a client machine.
- Re-run the stream after saving; the instance cache is per-session so a reload guarantees a rebuild.
- Check the console for the factory's own messages ('Aliyun NLS credentials are incomplete.') or the store's `Error creating provider instance for ...` log.
- If all three fields are valid and it still hits this line, report it as a factory contract bug.
Example fix
// before
const provider = await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)
if (!provider)
throw new Error('Failed to initialize Aliyun NLS provider.')
// after
const config = providerStore.getProviderConfig(providerId)
if (!config?.accessKeyId?.trim() || !config?.accessKeySecret?.trim() || !config?.appKey?.trim())
throw new Error('Aliyun NLS needs Access Key ID, Access Key Secret, and App Key before streaming.')
const provider = await providersStore.getProviderInstance<TranscriptionProviderWithExtraOptions<string, any>>(providerId)
if (!provider || typeof provider.transcription !== 'function')
throw new Error('Aliyun NLS factory returned no usable instance — check credentials and console logs') Defensive patterns
Strategy: validation
Validate before calling
const credentialsReady = computed(() => {
const c = providers.value[providerId]
return !!c?.accessKeyId?.trim() && !!c?.accessKeySecret?.trim() && !!c?.appKey?.trim()
})
if (!credentialsReady.value)
throw new Error('Aliyun NLS needs Access Key ID, Access Key Secret, and App Key') 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 { const provider = await providersStore.getProviderInstance(providerId) }
catch (error) {
// 'Aliyun NLS credentials are incomplete.' and 'Provider credentials ... not found'
// both surface here — show them verbatim; they name the exact missing field class
errorMessage.value = errorMessageFromValue(error)
} Prevention
- Complete all three credential fields before starting a stream.
- Use a public region (not -internal) from client machines.
- Run the built-in config validator before first use.
When it happens
Trigger: Starting stream transcription with one of accessKeyId/accessKeySecret/appKey blank; credentials saved as whitespace strings; a region value outside the supported enum surviving into config; factory/unspeech regression returning undefined instead of throwing its incomplete-credentials error.
Common situations: Creating an Aliyun NLS project and app key but pasting only part of the triple; rotating AccessKeys in the Aliyun console without updating all three fields; internal vs public region endpoints confusion (cn-shanghai vs cn-shanghai-internal); first-time setup where validation was skipped via force.
Related errors
- Failed to initialize transcription provider
- Failed to initialize transcription provider
- 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/40e811af35b6650f.
Report an issue: GitHub.