diegosouzapw/OmniRoute · error · Error

routeFetchLogsFailed

Error message

routeFetchLogsFailed

What it means

Fallback shown when the route-explainability call-log list fetch fails; the caught Error's own message wins, and this translated key is used when the failure is not an Error (e.g. abort or non-Error throw).

Solutions

  1. Check the call-logs listing endpoint and its query params
  2. Distinguish aborts from real failures before setting the error state
  3. Log the underlying status code for diagnosis
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

Thrown at src/app/(dashboard)/dashboard/analytics/RouteExplainabilityTab.tsx:477

}) {
  const t = useTranslations("analytics") as AnalyticsTranslator;
  const nodeMap = useProviderNodeMap();
  const [logs, setLogs] = useState<CallLogOption[]>([]);
  const [selectedId, setSelectedId] = useState(initialRequestId);
  const [explanation, setExplanation] = useState<RouteExplainabilityResponse | null>(null);
  const [logsLoading, setLogsLoading] = useState(true);
  const [explanationLoading, setExplanationLoading] = useState(false);
  const [error, setError] = useState<string | null>(null);

  const fetchLogs = useCallback(
    async (signal?: AbortSignal) => {
      setLogsLoading(true);
      try {
        const response = await fetch("/api/usage/call-logs?limit=75", {
          signal,
          cache: "no-store",
        });
        if (!response.ok) throw new Error(t("routeFetchLogsFailed"));
        const data = (await response.json()) as CallLogOption[];
        setLogs(data);
        setSelectedId((current) => {
          const preferredId = current || initialRequestId;
          if (preferredId && data.some((log) => log.id === preferredId)) {
            return preferredId;
          }
          return data[0]?.id || "";
        });
        setError(null);
      } catch (fetchError) {
        if ((fetchError as Error).name === "AbortError") return;
        setError(fetchError instanceof Error ? fetchError.message : t("routeFetchLogsFailed"));
        setLogs([]);
      } finally {
        if (!signal?.aborted) setLogsLoading(false);
      }
    },

View on GitHub (pinned to a179ffed5b)