earendil-works/pi · error · Error

Missing authorization code

Error message

Missing authorization code

What it means

Error "Missing authorization code" thrown in earendil-works/pi.

Source

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

				signal: manualAbort.signal,
			})
			.then((input) => {
				manualInput = input;
				callback.cancelWait();
			})
			.catch((error) => {
				manualError = error instanceof Error ? error : new Error(String(error));
				callback.cancelWait();
			});

		const credential = await callback.waitForCredential();
		if (manualError) throw manualError;
		if (credential) return credential;

		await manualPromise;
		if (manualError) throw manualError;
		const code = manualInput ? parseAuthorizationInput(manualInput) : undefined;
		if (!code) throw new Error("Missing authorization code");
		interaction.notify({ type: "progress", message: "Exchanging authorization code for an API key..." });
		return await exchangeAuthorizationCode(code, verifier, interaction.signal);
	} finally {
		manualAbort.abort();
		callback.close();
	}
}

export const openRouterOAuth: OAuthAuth = {
	name: "OpenRouter OAuth",
	loginLabel: "Sign in with OpenRouter",
	login: loginOpenRouter,
	async refresh(credential, _signal) {
		return credential;
	},
	async toAuth(credential) {
		return { apiKey: credential.access };
	},

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Repeat the login and complete the authorization; the callback lacked a code.

When it happens

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