{"record":{"id":"88fe95388c08f115","repo":"can1357/oh-my-pi","slug":"alibaba-coding-plan","errorCode":null,"errorMessage":"Alibaba Coding Plan","messagePattern":"Alibaba Coding Plan","errorType":"exception","errorClass":"AIError.OnPromptRequiredError","httpStatus":null,"severity":"error","filePath":"packages/ai/src/registry/alibaba-coding-plan.ts","lineNumber":14,"sourceCode":"import * as AIError from \"../error\";\nimport * as apiKeyValidation from \"./api-key-validation\";\nimport type { OAuthController, OAuthCredentials, OAuthLoginCallbacks } from \"./oauth/types\";\nimport type { ProviderDefinition } from \"./types\";\n\nconst DEFAULT_AUTH_URL = \"https://modelstudio.console.alibabacloud.com/\";\nconst CHINA_AUTH_URL = \"https://bailian.console.aliyun.com/?tab=model#/api-key\";\nconst DEFAULT_API_BASE_URL = \"https://coding-intl.dashscope.aliyuncs.com/v1\";\nconst CHINA_API_BASE_URL = \"https://coding.dashscope.aliyuncs.com/v1\";\nconst VALIDATION_MODEL = \"qwen3.5-plus\";\n\nexport async function loginAlibabaCodingPlan(options: OAuthController): Promise<OAuthCredentials> {\n\tif (!options.onPrompt) {\n\t\tthrow new AIError.OnPromptRequiredError(\"Alibaba Coding Plan\");\n\t}\n\n\t// Ask which endpoint to use\n\tconst endpointChoice = await options.onPrompt({\n\t\tmessage: \"Select Alibaba Coding Plan endpoint: 1=International (default), 2=China, 3=Custom — enter 1, 2, or 3\",\n\t\tplaceholder: \"1\",\n\t});\n\n\t// Check for abort after endpoint selection (Escape returns \"\")\n\tif (options.signal?.aborted) {\n\t\tthrow new AIError.LoginCancelledError();\n\t}\n\n\tconst choice = endpointChoice.trim();\n\tlet baseUrl: string;\n\tlet authUrl: string;\n\tlet instructions: string;\n\tif (choice === \"2\") {","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/ai/src/registry/alibaba-coding-plan.ts#L1-L32","documentation":"loginAlibabaCodingPlan performs an interactive OAuth-style login and requires an onPrompt callback to ask the user which endpoint (International/China/Custom) to use. If the OAuthController passed in has no onPrompt function — e.g. a non-interactive environment — it throws OnPromptRequiredError naming 'Alibaba Coding Plan' so the host application can surface an interactive prompt flow.","triggerScenarios":"Calling loginAlibabaCodingPlan with an OAuthController that lacks `onPrompt` (undefined), typically in headless/CI code or when constructing the controller without implementing the prompt hooks.","commonSituations":"Automated credential setup scripts; embedding the registry login in a CLI without wiring a prompt UI; running in a non-TTY context where the host skipped prompt handlers.","solutions":["Pass an OAuthController that implements `onPrompt` (returning the user's choice string)","Run the login flow through the interactive CLI that provides prompt handling","For headless environments, provision credentials directly (API key config) instead of invoking the interactive login"],"exampleFix":"// before\nawait loginAlibabaCodingPlan({});\n// after\nawait loginAlibabaCodingPlan({ onPrompt: async q => { /* show q.message, return answer */ } });","handlingStrategy":"type-guard","validationCode":"if (typeof controller?.onPrompt !== 'function') throw new Error('Alibaba Coding Plan login requires an interactive onPrompt callback');","typeGuard":"function canPrompt(c: OAuthController): c is OAuthController & { onPrompt: NonNullable<OAuthController['onPrompt']> } { return typeof c.onPrompt === 'function'; }","tryCatchPattern":"try { creds = await loginAlibabaCodingPlan(controller); } catch (e) { if (e instanceof AIError.OnPromptRequiredError) creds = await interactiveFallback('alibaba-coding-plan'); else throw e; }","preventionTips":["Verify onPrompt exists before any registry login","Run logins through the interactive CLI host in headless environments","Use a shared controller factory so prompt hooks are never dropped"],"tags":["oauth","interactive-login","configuration"],"backgroundTag":"onprompt-callback-required","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}