can1357/oh-my-pi · error · AIError.ConfigurationError

Custom URL is required for option 3

Error message

Custom URL is required for option 3

What it means

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.

Source

Thrown at packages/ai/src/registry/alibaba-token-plan.ts:54

		throw new AIError.LoginCancelledError();
	}

	const choice = endpointChoice.trim();
	let baseUrl: string;
	let authUrl: string;
	let instructions: string;
	if (choice === "2") {
		baseUrl = ALIBABA_TOKEN_PLAN_CN_BASE_URL;
		authUrl = CHINA_AUTH_URL;
		instructions = "Subscribe to the China (Beijing) 百炼 Token Plan and copy its dedicated API key";
	} else if (choice === "3") {
		const customUrl = await options.onPrompt({
			message: "Enter custom Token Plan base URL",
			placeholder: "https://token-plan.<region>.maas.aliyuncs.com/compatible-mode/v1",
		});
		const trimmedUrl = customUrl.trim().replace(/\/+$/, "");
		if (!trimmedUrl) {
			throw new AIError.ConfigurationError("Custom URL is required for option 3");
		}
		baseUrl = trimmedUrl;
		authUrl = INTERNATIONAL_AUTH_URL;
		instructions = "Copy your Token Plan API key for the custom endpoint";
	} else {
		baseUrl = ALIBABA_TOKEN_PLAN_BASE_URL;
		authUrl = INTERNATIONAL_AUTH_URL;
		instructions =
			"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.";
	}

	options.onAuth?.({ url: authUrl, instructions });

	const apiKeyInput = await options.onPrompt({
		message: "Paste your QwenCloud Token Plan API key",
		placeholder: "sk-sp-...",
	});
	if (options.signal?.aborted) {

View on GitHub (pinned to 9690622007)

Solutions

  1. Re-run login and supply a complete URL such as `https://token-plan.<region>.maas.aliyuncs.com/compatible-mode/v1`
  2. Pick option 1 (International) or 2 (China Beijing) unless a custom MaaS endpoint is truly required
  3. If scripting stdin, ensure both the choice line and the URL line are provided
Defensive patterns

Strategy: validation

Validate before calling

if (choice === '3' && !customUrl.trim().replace(/\/+$/, '')) throw new Error('Option 3 requires a non-empty custom Token Plan base URL');

Try / catch

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; }

Prevention

When it happens

Trigger: 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'.

Common situations: Selecting Custom accidentally when International was intended; empty clipboard paste; scripted stdin input that doesn't supply the URL line.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/60cbb2dcfcbb257f. Report an issue: GitHub.