diegosouzapw/OmniRoute · error · Error
errData?.error?.message || `HTTP
Error message
errData?.error?.message || `HTTP ${res.status}` What it means
Generic guard in throwOnErrorResponse: thrown when a cc-alias API call (GET state or its mutations) responds non-OK. The sentinel `HTTP ${res.status}` fires when the error body cannot be parsed or lacks error.message — the concrete cause is the status code itself.
Solutions
- Reload the provider detail page to refetch cc-alias state
- Check /api/providers/[id]/cc-alias logs for the failing handler
- Confirm the provider id/alias in the URL resolves to a real connection
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src/app/(dashboard)/dashboard/providers/[id]/components/ProviderCcAliasSection.tsx:51 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/7a8db3539dffeabd.
Report an issue: GitHub.
Appendix: source
Thrown at src/app/(dashboard)/dashboard/providers/[id]/components/ProviderCcAliasSection.tsx:51
const DEFAULT_STATE: CcAliasState = { provider: null, models: {} };
async function fetchCcAliasState(providerId: string): Promise<CcAliasState> {
const res = await fetch(`/api/providers/${providerId}/cc-alias`);
const data = await res.json();
return {
provider: data?.provider === "on" || data?.provider === "off" ? data.provider : null,
models: data?.models && typeof data.models === "object" ? data.models : {},
};
}
async function throwOnErrorResponse(res: Response): Promise<void> {
if (res.ok) return;
const errData = await res.json().catch(() => ({}));
const message =
typeof errData?.error === "string"
? errData.error
: errData?.error?.message || `HTTP ${res.status}`;
throw new Error(message);
}
async function putProviderSetting(providerId: string, value: CcAliasSettingValue): Promise<void> {
const res = await fetch(`/api/providers/${providerId}/cc-alias`, {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ scope: "provider", value }),
});
await throwOnErrorResponse(res);
}
async function putModelSetting(
providerId: string,
modelId: string,
value: CcAliasSettingValue
): Promise<void> {
const res = await fetch(`/api/providers/${providerId}/cc-alias`, {
method: "PUT",View on GitHub (pinned to a179ffed5b)