diegosouzapw/OmniRoute · error · Error

errorPayload.error || t("resetFailed")

Error message

errorPayload.error || t("resetFailed")

What it means

Per-provider pricing reset failure: after an explicit confirm, resetProvider() DELETEs /api/pricing?provider=<writeKey> to restore defaults; on non-ok it throws errorPayload.error or the localized 'resetFailed'. The provider's custom pricing remains active — the reset was not applied.

Solutions

  1. Check the DELETE response error string for the cause
  2. Confirm the provider key sent matches a known pricing entry
  3. Retry the reset after resolving; existing edits are untouched until it succeeds
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/settings/components/PricingTab.tsx:372 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/bedd28274094f251. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/settings/components/PricingTab.tsx:372

      }
    },
    [loadData, pricingData, showStatus, t]
  );

  const resetProvider = useCallback(
    async (providerAlias: string, pricingKey?: string) => {
      if (!confirm(t("resetPricingConfirm", { provider: providerAlias.toUpperCase() }))) return;

      try {
        const writeKey = pricingKey || providerAlias;
        const params = new URLSearchParams({ provider: writeKey });
        const response = await fetch(`/api/pricing?${params.toString()}`, {
          method: "DELETE",
        });

        if (!response.ok) {
          const errorPayload = (await response.json().catch(() => ({}))) as { error?: string };
          throw new Error(errorPayload.error || t("resetFailed"));
        }

        setEditedProviders((previous) => {
          const next = new Set(previous);
          next.delete(writeKey);
          return next;
        });
        await loadData();
        showStatus("success", t("pricingResetProvider", { provider: providerAlias.toUpperCase() }));
      } catch (error: any) {
        showStatus(
          "error",
          t("pricingResetFailedWithReason", {
            reason: error?.message || t("unknownError"),
          })
        );
      }
    },

View on GitHub (pinned to a179ffed5b)