diegosouzapw/OmniRoute · error · Error

profileLoadFailed

Error message

profileLoadFailed

What it means

Sentinel UI error shown when the profile page's parallel fetches (user level, badge definitions, earned badges) fail. Since Promise.all is used, one failing endpoint aborts all; the message masks which endpoint returned the error.

Solutions

  1. Reload the profile page to re-run all three fetches
  2. Check /api gamification level and badges endpoints individually
  3. Confirm the user's gamification profile exists in the DB
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/profile/page.tsx:111 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/49728336b10c537f. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/profile/page.tsx:111

  const locale = useLocale();
  const [userLevel, setUserLevel] = useState<UserLevel | null>(null);
  const [allBadges, setAllBadges] = useState<BadgeDef[]>([]);
  const [earnedBadges, setEarnedBadges] = useState<UserBadge[]>([]);
  const [loading, setLoading] = useState(true);
  const [error, setError] = useState("");
  const [selectedBadge, setSelectedBadge] = useState<BadgeDef | null>(null);
  const [streak] = useState(0); // streak data comes from future API

  const fetchData = useCallback(async () => {
    try {
      const [levelRes, badgesRes, earnedRes] = await Promise.all([
        fetch("/api/gamification/level"),
        fetch("/api/gamification/badges"),
        fetch("/api/gamification/badges/earned"),
      ]);

      if (!levelRes.ok && !badgesRes.ok && !earnedRes.ok) {
        throw new Error(tg("profileLoadFailed"));
      }

      if (levelRes.ok) {
        const data = await levelRes.json();
        setUserLevel(data.level ?? data);
      }
      if (badgesRes.ok) {
        const data = await badgesRes.json();
        setAllBadges(data.badges ?? data ?? []);
      }
      if (earnedRes.ok) {
        const data = await earnedRes.json();
        setEarnedBadges(data.badges ?? data ?? []);
      }
    } catch (loadError) {
      setError(loadError instanceof Error ? loadError.message : tg("profileLoadFailed"));
    } finally {
      setLoading(false);

View on GitHub (pinned to a179ffed5b)