diegosouzapw/OmniRoute · error · Error

t("tokensRevokeInviteFailed")

Error message

t("tokensRevokeInviteFailed")

What it means

Localized sentinel thrown when revoking an invite code fails: the DELETE to /api/gamification/invite?id=<inviteId> returned non-ok. The invite remains active; the fixed 'tokensRevokeInviteFailed' string carries no detail — the actual cause (auth, already-revoked invite, gamification store error) is in the response body or server logs.

Solutions

  1. Check the DELETE status/body — 404 means the invite was already revoked
  2. Confirm the gamification invite feature is enabled
  3. Refresh the invite list and retry if still present
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/tokens/page.tsx:186 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/866a072c9f84b320. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/tokens/page.tsx:186

        setNewInviteCode(data.code);
        await fetchData();
      } else {
        setInviteError(data.error || t("tokensCreateInviteFailed"));
      }
    } catch (error) {
      setInviteError(error instanceof Error ? error.message : t("tokensCreateInviteFailed"));
    } finally {
      setInviteLoading(false);
    }
  };

  const handleRevokeInvite = async (inviteId: string) => {
    setInviteError("");
    try {
      const response = await fetch(`/api/gamification/invite?id=${inviteId}`, {
        method: "DELETE",
      });
      if (!response.ok) throw new Error(t("tokensRevokeInviteFailed"));
      await fetchData();
    } catch (error) {
      setInviteError(error instanceof Error ? error.message : t("tokensRevokeInviteFailed"));
    }
  };

  const handleRedeem = async (e: React.FormEvent) => {
    e.preventDefault();
    setRedeemLoading(true);
    setRedeemMsg(null);

    try {
      const res = await fetch("/api/gamification/invite/redeem", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ code: redeemCode, apiKeyId: "current" }),
      });
      const data = await res.json();

View on GitHub (pinned to a179ffed5b)