earendil-works/pi · error · Error
Could not load Radius OAuth config from
Error message
Could not load Radius OAuth config from ${gateway}: ${response.status} ${await response.text()} What it means
loadRadiusOAuthDiscovery received a non-OK status from the gateway's /v1/oauth discovery endpoint; the message embeds the gateway URL, status, and response body to identify why discovery failed.
Solutions
- Check the gateway URL, status, and body; verify network access to the gateway.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/ai/src/auth/oauth/radius.ts:56 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/fd1b73c6d864bc1d.
Report an issue: GitHub.
Appendix: source
Thrown at packages/ai/src/auth/oauth/radius.ts:56
authorizationEndpoint: string;
};
type DeviceAuthorizationResponse = {
device_code: string;
user_code: string;
verification_uri: string;
expires_in: number;
interval?: number;
};
async function loadRadiusOAuthDiscovery(gateway: string, signal: AbortSignal): Promise<RadiusOAuthDiscovery> {
const response = await fetch(new URL("/v1/oauth", gateway), {
headers: { accept: "application/json" },
signal,
});
if (!response.ok) {
throw new Error(
`Could not load Radius OAuth config from ${gateway}: ${response.status} ${await response.text()}`,
);
}
const discovery = (await response.json()) as Partial<RadiusOAuthDiscovery>;
if (typeof discovery.authorizationEndpoint !== "string") {
throw new Error(`Invalid Radius OAuth config from ${gateway}`);
}
return { authorizationEndpoint: discovery.authorizationEndpoint };
}
class OAuthResponseError extends Error {
readonly status: number;
readonly oauthError?: string;
constructor(status: number, oauthError: string | undefined, description: string | undefined, message: string) {
const detail = oauthError
? descriptionView on GitHub (pinned to 4af9d21d3b)