earendil-works/pi · error · Error

${response.status} ${response.statusText}: ${await response.

Error message

${response.status} ${response.statusText}: ${await response.text()}

What it means

Error "${response.status} ${response.statusText}: ${await response.text()}" thrown in earendil-works/pi.

Source

Thrown at packages/ai/src/auth/oauth/github-copilot.ts:192

	const baseUrl = getGitHubCopilotBaseUrl(copilotToken, enterpriseDomain);
	// Some Individual accounts return false for every picker flag despite explicit enabled policies.
	// Limit the fallback to that endpoint so other account types keep strict picker semantics.
	const allowPolicyFallback = baseUrl === "https://api.individual.githubcopilot.com";
	const response = await fetchWithRateLimitRetry(
		`${baseUrl}/models`,
		{
			headers: {
				Accept: "application/json",
				Authorization: `Bearer ${copilotToken}`,
				...COPILOT_HEADERS,
				"X-GitHub-Api-Version": COPILOT_API_VERSION,
			},
		},
		signal,
		retryPolicy,
	);
	if (!response.ok) {
		throw new Error(`${response.status} ${response.statusText}: ${await response.text()}`);
	}
	return parseGitHubCopilotModelCatalog(await response.json(), allowPolicyFallback);
}

async function fetchJson(url: string, init: RequestInit): Promise<unknown> {
	const response = await fetch(url, init);
	if (!response.ok) {
		const text = await response.text();
		throw new Error(`${response.status} ${response.statusText}: ${text}`);
	}
	return response.json();
}

async function startDeviceFlow(domain: string, signal: AbortSignal): Promise<DeviceCodeResponse> {
	const urls = getUrls(domain);
	const data = await fetchJson(urls.deviceCodeUrl, {
		method: "POST",
		headers: {

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Check the HTTP status and body in the message; fix credentials or the endpoint.

When it happens

Trigger: Thrown at packages/ai/src/auth/oauth/github-copilot.ts:192 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/b8d2a189b2c3e489. Report an issue: GitHub.