moeru-ai/airi · error · Error

Aliyun NLS credentials are incomplete.

Error message

Aliyun NLS credentials are incomplete.

What it means

createProvider for the Aliyun NLS transcription provider trims accessKeyId, accessKeySecret, and appKey, and throws if any is empty — a construction-time config check that fires before any network activity. The required triple comes from the provider settings schema, so this indicates the provider was instantiated from an incomplete settings record.

Solutions

  1. Fill AccessKeyId, AccessKeySecret, and AppKey in the provider settings and save
  2. Trim inputs in the UI and mark all three fields required
  3. Delay provider instantiation until the config passes a completeness check
  4. Validate restored settings from storage before passing them to createProvider

Example fix

// before
const instance = providerAliyunNLS.createProvider({ accessKeyId: '', accessKeySecret, appKey })

// after
const complete = [config.accessKeyId, config.accessKeySecret, config.appKey]
  .every(v => v?.trim().length > 0)
if (!complete)
  throw new Error('Fill AccessKeyId, AccessKeySecret, and AppKey before enabling Aliyun NLS')
const instance = providerAliyunNLS.createProvider(config)
Defensive patterns

Strategy: validation

Validate before calling

const ready = [config.accessKeyId, config.accessKeySecret, config.appKey]
  .every(v => typeof v === 'string' && v.trim().length > 0)
if (!ready)
  showSettingsError('All three Aliyun NLS credentials are required')

Type guard

function hasAliyunNlsCredentials(config: AliyunNLSConfig): boolean {
  return Boolean(config.accessKeyId?.trim() && config.accessKeySecret?.trim() && config.appKey?.trim())
}

Try / catch

try {
  const instance = providerAliyunNLS.createProvider(config)
}
catch (err) {
  if (err.message.includes('credentials are incomplete'))
    focusFirstEmptyCredentialField()
}

Prevention

When it happens

Trigger: Provider settings saved with one or more credential fields empty or whitespace-only; settings storage missing keys after a migration; instantiating the provider programmatically with a partial config object.

Common situations: User hits Save before filling all three fields; a settings import brought everything except credentials; the config UI does not mark the fields required.

Related errors


AI-assisted analysis of moeru-ai/airi@f679616c34 (2026-08-18). Data as JSON: /api/errors/55935c71a4de2b77. Report an issue: GitHub.

Appendix: source

Thrown at packages/stage-ui/src/libs/providers/providers/aliyun-nls/index.ts:50

  description: 'nls-console.aliyun.com',
  descriptionLocalize: ({ t }) => t('settings.pages.providers.provider.aliyun-nls.description'),
  tasks: ['speech-to-text', 'automatic-speech-recognition', 'asr', 'stt', 'streaming-transcription'],
  icon: 'i-lobe-icons:alibabacloud',
  capabilities: {
    transcription: {
      protocol: 'websocket',
      generateOutput: false,
      streamOutput: true,
      streamInput: true,
    },
  },
  createProviderConfig: () => aliyunNlsConfigSchema,
  createProvider(config) {
    const accessKeyId = config.accessKeyId.trim()
    const accessKeySecret = config.accessKeySecret.trim()
    const appKey = config.appKey.trim()
    if (!accessKeyId || !accessKeySecret || !appKey)
      throw new Error('Aliyun NLS credentials are incomplete.')

    const provider = createAliyunNLSProvider(accessKeyId, accessKeySecret, appKey, {
      region: config.region ?? 'cn-shanghai',
    })

    return {
      transcription: (model: string, extraOptions?: AliyunRealtimeSpeechExtraOptions) => provider.speech(model, {
        ...extraOptions,
        sessionOptions: {
          format: 'pcm',
          sample_rate: 16000,
          enable_punctuation_prediction: true,
          enable_intermediate_result: true,
          enable_words: true,
          ...extraOptions?.sessionOptions,
        },
      }),
    } as TranscriptionProviderWithExtraOptions<string, AliyunRealtimeSpeechExtraOptions>

View on GitHub (pinned to f679616c34)