{"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":"validation","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/27111382b4a79a7e983289d6e983a06af185ed0f/packages/stage-ui/src/libs/providers/providers/aliyun-nls/index.ts#L32-L68","documentation":"Thrown by the Aliyun NLS provider's createProvider() when any of accessKeyId, accessKeySecret, or appKey is empty after trimming. The provider cannot construct a realtime transcription client without all three credentials, so it fails fast at provider construction rather than at the first WebSocket attempt.","triggerScenarios":"createProvider(config) runs with one or more of config.accessKeyId / config.accessKeySecret / config.appKey blank or whitespace-only. The user saved an Aliyun NLS provider entry without filling all credential fields, or a config import omitted them.","commonSituations":"User left a credential field empty in settings. Config restored from a backup that did not include secrets. Whitespace pasted with the key. Provider selected before credentials were fully entered.","solutions":["Open the Aliyun NLS provider settings and fill accessKeyId, accessKeySecret, and appKey with the values from the Aliyun console.","Trim whitespace when pasting keys; re-save and re-select the provider.","Mark all three fields required in the settings UI so the provider cannot be selected with incomplete credentials."],"exampleFix":"// before\ncreateProvider({ accessKeyId: '  ', accessKeySecret: 'secret', appKey: 'key' })\n// after\ncreateProvider({ accessKeyId: 'LTAI...', accessKeySecret: '...', appKey: '...' })","handlingStrategy":"validation","validationCode":"function hasAliyunCredentials(config: { accessKeyId: string, accessKeySecret: string, appKey: string }): boolean {\n  return [config.accessKeyId, config.accessKeySecret, config.appKey]\n    .every(v => v.trim().length > 0)\n}\n// before createProvider:\nif (!hasAliyunCredentials(config)) {\n  // mark provider incomplete; do not call createProvider\n}","typeGuard":"function isCompleteAliyunConfig(config: unknown): config is { accessKeyId: string, accessKeySecret: string, appKey: string } {\n  if (!config || typeof config !== 'object') return false\n  const c = config as Record<string, unknown>\n  return ['accessKeyId', 'accessKeySecret', 'appKey'].every(k => typeof c[k] === 'string' && (c[k] as string).trim().length > 0)\n}","tryCatchPattern":"try {\n  const provider = providerAliyunNls.createProvider(config)\n}\ncatch (err) {\n  if (err instanceof Error && err.message === 'Aliyun NLS credentials are incomplete.') {\n    // prompt user to fill all three credential fields\n  }\n  else throw err\n}","preventionTips":["Mark accessKeyId, accessKeySecret, and appKey required in the settings UI.","Do not allow selecting the Aliyun NLS provider until all three are non-empty.","Trim values on save to avoid whitespace-only failures."],"tags":["configuration","aliyun","nls","credentials","validation","precondition"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}