diegosouzapw/OmniRoute · error · Error

data.error || t("proxySubscription.saveFailed")

Error message

data.error || t("proxySubscription.saveFailed")

What it means

Subscription create/update failure: the POST (new) or PATCH (edit, /{editingId}) to /api/v1/management/proxy-subscriptions returned non-ok; the thrown message is data.error from the body or the localized 'saveFailed'. Client-side guards (name/url/ruleProviders) already passed, so this is a server-side rejection — validation, duplicate, or management-API error.

Solutions

  1. Read data.error for the server's sanitized rejection reason
  2. Fix duplicates or invalid URL/mode/provider values it names
  3. Retry save; the list reloads only on success
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

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

        ruleProviders: form.mode === "rule" ? form.ruleProviders : null,
        localCoreEndpoint: form.localCoreEndpoint.trim() || null,
        updateIntervalMinutes: Number(form.updateIntervalMinutes) || 60,
        enabled: form.enabled,
      };
      const res = editingId
        ? await fetch(`/api/v1/management/proxy-subscriptions/${editingId}`, {
            method: "PATCH",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify(payload),
          })
        : await fetch("/api/v1/management/proxy-subscriptions", {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify(payload),
          });
      if (!res.ok) {
        const data = await res.json().catch(() => ({}));
        throw new Error(data.error || t("proxySubscription.saveFailed"));
      }
      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 }),
      });

View on GitHub (pinned to a179ffed5b)