diegosouzapw/OmniRoute · error · Error
body.error || `HTTP
Error message
body.error || `HTTP ${response.status}` What it means
The Provider USD cost modal failed to load window-cost data from the internal dashboard endpoint. The async load() checks response.ok; when it fails it prefers the JSON body's error.message and falls back to a generic 'HTTP <status>' string when the body carries no error field (e.g. empty or non-JSON error responses).
Solutions
- Check the dashboard endpoint for the provider/connection and confirm it returns a JSON body with an error.message on failure
- Retry the modal after verifying the OmniRoute server is healthy and the provider connection exists
- If only 'HTTP <status>' is shown, inspect the server logs for the matching status to find the real cause
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src/app/(dashboard)/dashboard/usage/components/ProviderLimits/ProviderUsdCostModal.tsx:102 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/43ccee91222eee70.
Report an issue: GitHub.
Appendix: source
Thrown at src/app/(dashboard)/dashboard/usage/components/ProviderLimits/ProviderUsdCostModal.tsx:102
const [payload, setPayload] = useState<ProviderWindowCostPayload | null>(null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const [simulatedPercent, setSimulatedPercent] = useState(25);
useEffect(() => {
if (!isOpen || !connection?.provider) return;
let alive = true;
async function load() {
setLoading(true);
setError(null);
try {
const params = new URLSearchParams({ provider: String(connection.provider) });
if (connection.id) params.set("connectionId", String(connection.id));
const response = await fetch(`/api/usage/provider-window-costs?${params.toString()}`);
if (!response.ok) {
const body = await response.json().catch(() => ({}));
throw new Error(body.error || `HTTP ${response.status}`);
}
const data = (await response.json()) as ProviderWindowCostPayload;
if (alive) setPayload(data);
} catch (loadError) {
if (alive) {
setError(loadError instanceof Error ? loadError.message : t("loadUsdCostsFailed"));
setPayload(null);
}
} finally {
if (alive) setLoading(false);
}
}
void load();
return () => {
alive = false;
};
}, [isOpen, connection?.id, connection?.provider, t]);View on GitHub (pinned to a179ffed5b)