earendil-works/pi · error

Could not load Radius config from

Error message

Could not load Radius config from ${gateway}: ${response.status}: ${truncateHttpBody(await response.text())}

What it means

The Radius gateway's /v1/config endpoint returned a non-OK status; status and a truncated body (512 chars) are embedded. Fires when the gateway URL is wrong, the API key is rejected, or the gateway is unavailable.

Solutions

  1. Check the gateway status and body; verify network access to the gateway.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/ai/src/providers/radius-config.ts:89 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/d86e046386b29254. Report an issue: GitHub.

Appendix: source

Thrown at packages/ai/src/providers/radius-config.ts:89

	const config = getRadiusCredentialConfig(credential);
	return config ? getRadiusModelsFromConfig(providerId, config) : [];
}

function truncateHttpBody(body: string): string {
	const trimmed = body.trim();
	return trimmed.length > 512 ? `${trimmed.slice(0, 512)}…` : trimmed;
}

export async function loadRadiusGatewayConfig(
	gateway: string,
	apiKey?: string,
	signal?: AbortSignal,
): Promise<RadiusGatewayConfig> {
	const headers: Record<string, string> = { accept: "application/json" };
	if (apiKey) headers.authorization = `Bearer ${apiKey}`;
	const response = await fetch(new URL("/v1/config", gateway), { headers, signal });
	if (!response.ok) {
		throw new Error(
			`Could not load Radius config from ${gateway}: ${response.status}: ${truncateHttpBody(await response.text())}`,
		);
	}
	const config = sanitizeRadiusGatewayConfig(await response.json());
	if (!config) throw new Error(`Invalid Radius config from ${gateway}`);
	return config;
}

View on GitHub (pinned to 4af9d21d3b)