earendil-works/pi · error · Error

OpenRouter OAuth response carries no "key"

Error message

OpenRouter OAuth response carries no "key"

What it means

Error "OpenRouter OAuth response carries no "key"" thrown in earendil-works/pi.

Source

Thrown at packages/ai/src/auth/oauth/openrouter.ts:124

		} catch {
			if (response.ok) throw new Error("OpenRouter OAuth returned invalid JSON");
		}
	} catch (error) {
		if (signal.aborted) throw new Error("Login cancelled");
		if (controller.signal.aborted) throw new Error("OpenRouter OAuth token exchange timed out");
		throw error;
	} finally {
		clearTimeout(timeout);
		signal.removeEventListener("abort", onAbort);
	}

	if (!response.ok) {
		const detail = errorDetail(body);
		throw new Error(`OpenRouter OAuth key exchange failed (HTTP ${response.status})${detail ? `: ${detail}` : ""}`);
	}

	if (typeof body.key !== "string" || body.key.length === 0) {
		throw new Error('OpenRouter OAuth response carries no "key"');
	}

	return {
		type: "oauth",
		access: body.key,
		refresh: "",
		expires: Number.MAX_SAFE_INTEGER,
	};
}

async function startCallbackServer(
	callbackPath: string,
	verifier: string,
	signal: AbortSignal,
): Promise<OpenRouterCallbackServer> {
	if (signal.aborted) throw new Error("Login cancelled");
	const callbackHost = getCallbackHost();
	let resolveCredential: (credential: OAuthCredential | null) => void = () => {};

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Retry the exchange; the response did not carry the API key field.

When it happens

Trigger: Thrown at packages/ai/src/auth/oauth/openrouter.ts:124 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/44b30cebdb1c16e9. Report an issue: GitHub.