diegosouzapw/OmniRoute · error · Error

routeExplainFailed

Error message

routeExplainFailed

What it means

The route-explainability loader's non-OK guard: fetching /api/usage/route-explain/<requestId> failed and the localized 'routeExplainFailed' key is thrown to set the explanation error state. Distinct from routeFetchLogsFailed, which covers the companion logs fetch.

Solutions

  1. Confirm the requestId exists in call logs before fetching the explanation
  2. Surface res.status in the error message
  3. Check server logs for the explain route
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

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

        setError(fetchError instanceof Error ? fetchError.message : t("routeFetchLogsFailed"));
        setLogs([]);
      } finally {
        if (!signal?.aborted) setLogsLoading(false);
      }
    },
    [initialRequestId, t]
  );

  const fetchExplanation = useCallback(
    async (requestId: string, signal?: AbortSignal) => {
      if (!requestId) return;
      setExplanationLoading(true);
      try {
        const response = await fetch(`/api/usage/route-explain/${encodeURIComponent(requestId)}`, {
          signal,
          cache: "no-store",
        });
        if (!response.ok) throw new Error(t("routeExplainFailed"));
        const data = (await response.json()) as RouteExplainabilityResponse;
        setExplanation(data);
        setError(null);
      } catch (fetchError) {
        if ((fetchError as Error).name === "AbortError") return;
        setError(fetchError instanceof Error ? fetchError.message : t("routeExplainFailed"));
        setExplanation(null);
      } finally {
        if (!signal?.aborted) setExplanationLoading(false);
      }
    },
    [t]
  );

  useEffect(() => {
    const controller = new AbortController();
    fetchLogs(controller.signal);
    return () => controller.abort();

View on GitHub (pinned to a179ffed5b)