{"record":{"id":"55935c71a4de2b77","repo":"moeru-ai/airi","slug":"aliyun-nls-credentials-are-incomplete","errorCode":null,"errorMessage":"Aliyun NLS credentials are incomplete.","messagePattern":"Aliyun NLS credentials are incomplete\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/stage-ui/src/libs/providers/providers/aliyun-nls/index.ts","lineNumber":50,"sourceCode":"  description: 'nls-console.aliyun.com',\n  descriptionLocalize: ({ t }) => t('settings.pages.providers.provider.aliyun-nls.description'),\n  tasks: ['speech-to-text', 'automatic-speech-recognition', 'asr', 'stt', 'streaming-transcription'],\n  icon: 'i-lobe-icons:alibabacloud',\n  capabilities: {\n    transcription: {\n      protocol: 'websocket',\n      generateOutput: false,\n      streamOutput: true,\n      streamInput: true,\n    },\n  },\n  createProviderConfig: () => aliyunNlsConfigSchema,\n  createProvider(config) {\n    const accessKeyId = config.accessKeyId.trim()\n    const accessKeySecret = config.accessKeySecret.trim()\n    const appKey = config.appKey.trim()\n    if (!accessKeyId || !accessKeySecret || !appKey)\n      throw new Error('Aliyun NLS credentials are incomplete.')\n\n    const provider = createAliyunNLSProvider(accessKeyId, accessKeySecret, appKey, {\n      region: config.region ?? 'cn-shanghai',\n    })\n\n    return {\n      transcription: (model: string, extraOptions?: AliyunRealtimeSpeechExtraOptions) => provider.speech(model, {\n        ...extraOptions,\n        sessionOptions: {\n          format: 'pcm',\n          sample_rate: 16000,\n          enable_punctuation_prediction: true,\n          enable_intermediate_result: true,\n          enable_words: true,\n          ...extraOptions?.sessionOptions,\n        },\n      }),\n    } as TranscriptionProviderWithExtraOptions<string, AliyunRealtimeSpeechExtraOptions>","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/moeru-ai/airi/blob/f679616c34f1cf6d282c8d64264242af944b3fed/packages/stage-ui/src/libs/providers/providers/aliyun-nls/index.ts#L32-L68","documentation":"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.","triggerScenarios":"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.","commonSituations":"User hits Save before filling all three fields; a settings import brought everything except credentials; the config UI does not mark the fields required.","solutions":["Fill AccessKeyId, AccessKeySecret, and AppKey in the provider settings and save","Trim inputs in the UI and mark all three fields required","Delay provider instantiation until the config passes a completeness check","Validate restored settings from storage before passing them to createProvider"],"exampleFix":"// before\nconst instance = providerAliyunNLS.createProvider({ accessKeyId: '', accessKeySecret, appKey })\n\n// after\nconst complete = [config.accessKeyId, config.accessKeySecret, config.appKey]\n  .every(v => v?.trim().length > 0)\nif (!complete)\n  throw new Error('Fill AccessKeyId, AccessKeySecret, and AppKey before enabling Aliyun NLS')\nconst instance = providerAliyunNLS.createProvider(config)","handlingStrategy":"validation","validationCode":"const ready = [config.accessKeyId, config.accessKeySecret, config.appKey]\n  .every(v => typeof v === 'string' && v.trim().length > 0)\nif (!ready)\n  showSettingsError('All three Aliyun NLS credentials are required')","typeGuard":"function hasAliyunNlsCredentials(config: AliyunNLSConfig): boolean {\n  return Boolean(config.accessKeyId?.trim() && config.accessKeySecret?.trim() && config.appKey?.trim())\n}","tryCatchPattern":"try {\n  const instance = providerAliyunNLS.createProvider(config)\n}\ncatch (err) {\n  if (err.message.includes('credentials are incomplete'))\n    focusFirstEmptyCredentialField()\n}","preventionTips":["Mark all credential fields required in the settings schema","Disable the provider's enable toggle until the triple is complete","Never instantiate providers from unvalidated restored settings"],"tags":["aliyun","nls","credentials","configuration","validation"],"backgroundTag":"missing-api-credentials","analyzedSha":"f679616c34f1cf6d282c8d64264242af944b3fed","analyzedAt":"2026-08-18T17:29:58.153Z","contentChangedAt":"2026-08-18T17:29:58.153Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}