earendil-works/pi · error · Error
Radius OAuth is only available in Node.js environments
Error message
Radius OAuth is only available in Node.js environments
What it means
startOAuthCallbackServer needs Node's http module to listen for the OAuth redirect; this fires when that module was never loaded, i.e. the runtime is not Node.js and no localhost callback can be opened.
Solutions
- Run Radius OAuth login in a Node.js environment.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at packages/ai/src/auth/oauth/radius.ts:149 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/5da82cfb22e12da2.
Report an issue: GitHub.
Appendix: source
Thrown at packages/ai/src/auth/oauth/radius.ts:149
};
return {
type: "oauth",
access: data.access_token,
refresh: data.refresh_token,
expires: Date.now() + data.expires_in * 1000 - TOKEN_EXPIRY_SKEW_MS,
scope: data.scope,
};
}
type OAuthCallbackServer = {
waitForCode(): Promise<string | null>;
close(): void;
};
function startOAuthCallbackServer(expectedState: string, signal: AbortSignal): Promise<OAuthCallbackServer> {
if (!_http) {
throw new Error("Radius OAuth is only available in Node.js environments");
}
let settle: (code: string | null) => void = () => {};
let settled = false;
const wait = new Promise<string | null>((resolve) => {
settle = resolve;
});
const finish = (code: string | null) => {
if (settled) {
return;
}
settled = true;
signal.removeEventListener("abort", onAbort);
settle(code);
};
const onAbort = () => finish(null);
signal.addEventListener("abort", onAbort, { once: true });
View on GitHub (pinned to 4af9d21d3b)