diegosouzapw/OmniRoute · error · Error

Failed to fetch utilization data

Error message

Failed to fetch utilization data

What it means

fetchUtilization got a non-OK status from /api/usage/utilization for the selected range/aggregateBy combination. A catch-all for the utilization API failing (bad range param, server error); the status is not preserved, so the user sees only the generic message.

Solutions

  1. Include res.status in the thrown message
  2. Verify the utilization endpoint contract and the aggregateBy param
  3. Check server logs for the failing utilization query
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/analytics/ProviderUtilizationTab.tsx:107 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/f88a4363c8b0cce0. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/analytics/ProviderUtilizationTab.tsx:107

  const fetchUtilization = useCallback(
    async (
      selectedRange: UtilizationTimeRange,
      selectedAggregate: "provider" | "connection",
      signal?: AbortSignal
    ) => {
      setLoading(true);

      try {
        const response = await fetch(
          `/api/usage/utilization?range=${selectedRange}&aggregateBy=${selectedAggregate}`,
          {
            signal,
            cache: "no-store",
          }
        );

        if (!response.ok) {
          throw new Error("Failed to fetch utilization data");
        }

        const json = (await response.json()) as ProviderUtilizationResponse;
        setData(json);
        setError(null);
      } catch (fetchError) {
        if (fetchError instanceof DOMException && fetchError.name === "AbortError") {
          return;
        }

        setError(
          fetchError instanceof Error ? fetchError.message : "Failed to fetch utilization data"
        );
        setData(null);
      } finally {
        if (!signal?.aborted) {
          setLoading(false);
        }

View on GitHub (pinned to a179ffed5b)