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/openai-codex.ts:499

		if (result?.code) {
			code = result.code;
		} else if (manualCode) {
			const parsed = parseAuthorizationInput(manualCode);
			if (parsed.state && parsed.state !== state) throw new Error("State mismatch");
			code = parsed.code;
		}

		if (!code) {
			await manualPromise;
			if (manualError) throw manualError;
			if (manualCode) {
				const parsed = parseAuthorizationInput(manualCode);
				if (parsed.state && parsed.state !== state) throw new Error("State mismatch");
				code = parsed.code;
			}
		}

		if (!code) throw new Error("Missing authorization code");
		return exchangeAuthorizationCodeForCredentials(code, verifier, REDIRECT_URI, interaction.signal);
	} finally {
		interaction.signal.removeEventListener("abort", onAbort);
		manualAbort.abort();
		server.close();
	}
}

/**
 * Refresh OpenAI Codex OAuth token
 */
async function refreshOpenAICodexToken(refreshToken: string, signal: AbortSignal): Promise<OAuthCredential> {
	return credentialsFromToken(await refreshAccessToken(refreshToken, signal));
}

export const openaiCodexOAuth: OAuthAuth = {
	name: "OpenAI (ChatGPT Plus/Pro)",
	isSubscription: true,

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/openai-codex.ts:499 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/8095a172c20520fa. Report an issue: GitHub.