earendil-works/pi · error · Error
OAuth state mismatch
Error message
OAuth state mismatch
What it means
Error "OAuth state mismatch" thrown in earendil-works/pi.
Source
Thrown at packages/ai/src/auth/oauth/anthropic.ts:287
signal: manualAbort.signal,
})
.then((input) => {
manualInput = input;
server.cancelWait();
})
.catch((error) => {
manualError = error instanceof Error ? error : new Error(String(error));
server.cancelWait();
});
const result = await server.waitForCode();
if (manualError) throw manualError;
if (result?.code) {
code = result.code;
state = result.state;
} else if (manualInput) {
const parsed = parseAuthorizationInput(manualInput);
if (parsed.state && parsed.state !== verifier) throw new Error("OAuth state mismatch");
code = parsed.code;
state = parsed.state ?? verifier;
}
if (!code) {
await manualPromise;
if (manualError) throw manualError;
if (manualInput) {
const parsed = parseAuthorizationInput(manualInput);
if (parsed.state && parsed.state !== verifier) throw new Error("OAuth state mismatch");
code = parsed.code;
state = parsed.state ?? verifier;
}
}
if (!code) throw new Error("Missing authorization code");
if (!state) throw new Error("Missing OAuth state");
interaction.notify({ type: "progress", message: "Exchanging authorization code for tokens..." });View on GitHub (pinned to 4af9d21d3b)
Solutions
- Restart the OAuth flow; the callback state does not match the stored state.
When it happens
Trigger: Thrown at packages/ai/src/auth/oauth/anthropic.ts:287 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/3268fd22d41e97cb.
Report an issue: GitHub.