diegosouzapw/OmniRoute · error · Error

data?.error?.message || t("loadFailed")

Error message

data?.error?.message || t("loadFailed")

What it means

useDiscoveryResults' load: GET /api/discovery/results returned non-OK and the body's error.message (or error) is preferred over the localized 'loadFailed' key. Leaves the discovery results list empty with an error feedback entry; reload is the only recovery.

Solutions

  1. Verify the results endpoint and its persistence layer
  2. Return structured error bodies from the results route
  3. Check server logs for the failing load
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/discovery/DiscoveryPageClient.tsx:73 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/1062290eef3783e1. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/discovery/DiscoveryPageClient.tsx:73

    return true;
  } catch (err) {
    setFeedback({ type: "error", message: err instanceof Error ? err.message : t(failKey) });
    return false;
  }
}

/** Results list + loading + feedback state, plus the reload function. */
function useDiscoveryResults(t: Translate) {
  const [results, setResults] = useState<DiscoveryResult[]>([]);
  const [loading, setLoading] = useState(true);
  const [feedback, setFeedback] = useState<Feedback>(null);

  const load = useCallback(async () => {
    setLoading(true);
    try {
      const res = await fetch("/api/discovery/results");
      const data = await res.json().catch(() => ({}));
      if (!res.ok) throw new Error(data?.error?.message || t("loadFailed"));
      setResults(Array.isArray(data.results) ? data.results : []);
    } catch (err) {
      setFeedback({ type: "error", message: err instanceof Error ? err.message : t("loadFailed") });
    } finally {
      setLoading(false);
    }
  }, [t]);

  useEffect(() => {
    void load();
  }, [load]);

  return { results, loading, feedback, setFeedback, load };
}

/** Scan / verify / delete actions and their transient state. */
function useDiscoveryActions(
  t: Translate,

View on GitHub (pinned to a179ffed5b)