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

When the user selects endpoint option 3 (Custom) during Alibaba Coding Plan login, the flow prompts for a custom base URL. If the entered URL is empty or only slashes/whitespace after trimming and trailing-slash stripping, a ConfigurationError is thrown because a custom endpoint without a URL cannot be used.

Source

Thrown at packages/ai/src/registry/alibaba-coding-plan.ts:43

		throw new AIError.LoginCancelledError();
	}

	const choice = endpointChoice.trim();
	let baseUrl: string;
	let authUrl: string;
	let instructions: string;
	if (choice === "2") {
		baseUrl = CHINA_API_BASE_URL;
		authUrl = CHINA_AUTH_URL;
		instructions = "Copy your API key from the Alibaba Cloud Bailian console (China mainland)";
	} else if (choice === "3") {
		const customUrl = await options.onPrompt({
			message: "Enter custom base URL",
			placeholder: "https://your-proxy.com/v1",
		});
		const trimmedUrl = customUrl.trim().replace(/\/+$/, "");
		if (!trimmedUrl) {
			throw new AIError.ConfigurationError("Custom URL is required for option 3");
		}
		baseUrl = trimmedUrl;
		authUrl = DEFAULT_AUTH_URL;
		instructions = "Copy your API key from the Alibaba Cloud DashScope console";
	} else {
		baseUrl = DEFAULT_API_BASE_URL;
		authUrl = DEFAULT_AUTH_URL;
		instructions = "Copy your API key from the Alibaba Cloud DashScope console (International)";
	}

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

	const apiKey = await options.onPrompt({
		message: "Paste your Alibaba Coding Plan API key",
		placeholder: "sk-...",

View on GitHub (pinned to 9690622007)

Solutions

  1. Re-run the login and enter a full base URL like `https://your-proxy.com/v1` for option 3
  2. Choose option 1 (International) or 2 (China) if a custom proxy is not actually needed
  3. Verify the paste actually landed in the prompt input before pressing Enter
Defensive patterns

Strategy: validation

Validate before calling

if (choice === '3' && !/^https?:\/\/.+/.test(customUrl.trim())) throw new Error('Option 3 requires a full http(s) base URL');

Try / catch

try { creds = await loginAlibabaCodingPlan(controller); } catch (e) { if (e instanceof AIError.ConfigurationError && String(e.message).includes('Custom URL')) creds = await loginAlibabaCodingPlan(controllerChoosingDefault); else throw e; }

Prevention

When it happens

Trigger: Choosing option 3 at the 'Select Alibaba Coding Plan endpoint' prompt and then pressing Enter (or entering only spaces/slashes) at the 'Enter custom base URL' prompt.

Common situations: User selects Custom by mistake instead of option 1 (International); copy-paste failed so the clipboard was empty; terminal swallowed the pasted value.

Related errors


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