{"record":{"id":"60cbb2dcfcbb257f","repo":"can1357/oh-my-pi","slug":"custom-url-is-required-for-option-3-60cbb2","errorCode":null,"errorMessage":"Custom URL is required for option 3","messagePattern":"Custom URL is required for option 3","errorType":"exception","errorClass":"AIError.ConfigurationError","httpStatus":null,"severity":"error","filePath":"packages/ai/src/registry/alibaba-token-plan.ts","lineNumber":54,"sourceCode":"\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\") {\n\t\tbaseUrl = ALIBABA_TOKEN_PLAN_CN_BASE_URL;\n\t\tauthUrl = CHINA_AUTH_URL;\n\t\tinstructions = \"Subscribe to the China (Beijing) 百炼 Token Plan and copy its dedicated API key\";\n\t} else if (choice === \"3\") {\n\t\tconst customUrl = await options.onPrompt({\n\t\t\tmessage: \"Enter custom Token Plan base URL\",\n\t\t\tplaceholder: \"https://token-plan.<region>.maas.aliyuncs.com/compatible-mode/v1\",\n\t\t});\n\t\tconst trimmedUrl = customUrl.trim().replace(/\\/+$/, \"\");\n\t\tif (!trimmedUrl) {\n\t\t\tthrow new AIError.ConfigurationError(\"Custom URL is required for option 3\");\n\t\t}\n\t\tbaseUrl = trimmedUrl;\n\t\tauthUrl = INTERNATIONAL_AUTH_URL;\n\t\tinstructions = \"Copy your Token Plan API key for the custom endpoint\";\n\t} else {\n\t\tbaseUrl = ALIBABA_TOKEN_PLAN_BASE_URL;\n\t\tauthUrl = INTERNATIONAL_AUTH_URL;\n\t\tinstructions =\n\t\t\t\"Subscribe to Token Plan Individual and copy its dedicated API key. Keep this page open; the next prompt explains how to enable optional quota reporting.\";\n\t}\n\n\toptions.onAuth?.({ url: authUrl, instructions });\n\n\tconst apiKeyInput = await options.onPrompt({\n\t\tmessage: \"Paste your QwenCloud Token Plan API key\",\n\t\tplaceholder: \"sk-sp-...\",\n\t});\n\tif (options.signal?.aborted) {","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/ai/src/registry/alibaba-token-plan.ts#L36-L72","documentation":"Selecting option 3 (Custom) in the QwenCloud Token Plan login triggers a follow-up prompt for a custom base URL. If the answer is blank after trimming and stripping trailing slashes, loginAlibabaTokenPlan throws ConfigurationError 'Custom URL is required for option 3' because the custom region endpoint is unusable without a URL.","triggerScenarios":"Answering '3' to the region prompt and then submitting an empty value (just Enter, whitespace, or only slashes) at 'Enter custom Token Plan base URL'.","commonSituations":"Selecting Custom accidentally when International was intended; empty clipboard paste; scripted stdin input that doesn't supply the URL line.","solutions":["Re-run login and supply a complete URL such as `https://token-plan.<region>.maas.aliyuncs.com/compatible-mode/v1`","Pick option 1 (International) or 2 (China Beijing) unless a custom MaaS endpoint is truly required","If scripting stdin, ensure both the choice line and the URL line are provided"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (choice === '3' && !customUrl.trim().replace(/\\/+$/, '')) throw new Error('Option 3 requires a non-empty custom Token Plan base URL');","typeGuard":null,"tryCatchPattern":"try { key = await loginAlibabaTokenPlan(controller); } catch (e) { if (e instanceof AIError.ConfigurationError && String(e.message).includes('Custom URL')) key = await loginAlibabaTokenPlan(controllerChoosingDefault); else throw e; }","preventionTips":["Prefer International/China options unless a custom endpoint is required","Document known region URL formats near the login call","When scripting stdin, supply both choice and URL lines"],"tags":["configuration","interactive-login","url"],"backgroundTag":"missing-config-value","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}