diegosouzapw/OmniRoute · error · CodexDeviceFlowError
exchange_failed
exchange_failed
Error message
Token exchange failed (${res.status}): ${text} What it means
Error "Token exchange failed (${res.status}): ${text}" thrown in diegosouzapw/OmniRoute.
Source
Thrown at src/lib/oauth/codexDeviceFlow.ts:270
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: new URLSearchParams({
grant_type: "authorization_code",
client_id: clientId,
code: authorizationCode,
code_verifier: codeVerifier,
redirect_uri: REDIRECT_URI,
}).toString(),
signal,
});
} catch (e: any) {
if (e?.name === "AbortError") throw new CodexDeviceFlowError("aborted", "Device flow aborted");
throw new CodexDeviceFlowError("network", `Token exchange failed: ${e?.message || e}`);
}
if (!res.ok) {
const text = await res.text().catch(() => "");
throw new CodexDeviceFlowError(
"exchange_failed",
`Token exchange failed (${res.status}): ${text}`,
res.status
);
}
const data: any = await res.json();
if (!data.access_token) {
throw new CodexDeviceFlowError("exchange_failed", "Token exchange returned no access_token");
}
return {
access_token: data.access_token,
refresh_token: data.refresh_token,
id_token: data.id_token,
expires_in: data.expires_in,
};
}
View on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at src/lib/oauth/codexDeviceFlow.ts:270 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/684884734d0d3e46.
Report an issue: GitHub.