diegosouzapw/OmniRoute · error · Error

t("proxySubscription.toggleFailed")

Error message

t("proxySubscription.toggleFailed")

What it means

Localized toggle sentinel: the PATCH to /api/v1/management/proxy-subscriptions/{id} with {enabled: !sub.enabled} returned non-ok, so the subscription's enabled flag did not change. The fixed 'toggleFailed' message replaces the status — the row stays in its previous state and busyId is cleared.

Solutions

  1. Check the PATCH response body for the rejection cause
  2. Confirm the subscription still exists (not deleted concurrently)
  3. Retry the toggle after the list reload
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/settings/components/proxy/SubscriptionTab.tsx:195 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/d8761b75dce33db7. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/settings/components/proxy/SubscriptionTab.tsx:195

      }
      resetForm();
      await load();
    } catch (e) {
      setFormError(e instanceof Error ? e.message : String(e));
    } finally {
      setSaving(false);
    }
  };

  const toggleEnabled = async (sub: SubscriptionRecord) => {
    setBusyId(sub.id);
    try {
      const res = await fetch(`/api/v1/management/proxy-subscriptions/${sub.id}`, {
        method: "PATCH",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ enabled: !sub.enabled }),
      });
      if (!res.ok) throw new Error(t("proxySubscription.toggleFailed"));
      await load();
    } catch (e) {
      setError(e instanceof Error ? e.message : String(e));
    } finally {
      setBusyId(null);
    }
  };

  const refresh = async (sub: SubscriptionRecord) => {
    setBusyId(sub.id);
    try {
      const res = await fetch(`/api/v1/management/proxy-subscriptions/${sub.id}/refresh`, {
        method: "POST",
      });
      if (!res.ok) throw new Error(t("proxySubscription.refreshFailed"));
      await load();
    } catch (e) {
      setError(e instanceof Error ? e.message : String(e));

View on GitHub (pinned to a179ffed5b)