earendil-works/pi · error · Error

HTTP request failed. status=${response.status}; url=${url};

Error message

HTTP request failed. status=${response.status}; url=${url}; body=${responseBody}

What it means

Error "HTTP request failed. status=${response.status}; url=${url}; body=${responseBody}" thrown in earendil-works/pi.

Source

Thrown at packages/ai/src/auth/oauth/anthropic.ts:184

		});
	});
}

async function postJson(url: string, body: Record<string, string | number>, signal: AbortSignal): Promise<string> {
	const response = await fetch(url, {
		method: "POST",
		headers: {
			"Content-Type": "application/json",
			Accept: "application/json",
		},
		body: JSON.stringify(body),
		signal: AbortSignal.any([signal, AbortSignal.timeout(30_000)]),
	});

	const responseBody = await response.text();

	if (!response.ok) {
		throw new Error(`HTTP request failed. status=${response.status}; url=${url}; body=${responseBody}`);
	}

	return responseBody;
}

async function exchangeAuthorizationCode(
	code: string,
	state: string,
	verifier: string,
	redirectUri: string,
	signal: AbortSignal,
): Promise<OAuthCredential> {
	let responseBody: string;
	try {
		responseBody = await postJson(
			TOKEN_URL,
			{
				grant_type: "authorization_code",

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Check the status, url, and body in the message; fix the request or credentials.

When it happens

Trigger: Thrown at packages/ai/src/auth/oauth/anthropic.ts:184 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/b204abd688c04593. Report an issue: GitHub.