diegosouzapw/OmniRoute · error · Error

data?.error?.message || data?.error || "Failed to update…

Error message

data?.error?.message || data?.error || "Failed to update provider"

What it means

Thrown when PATCH /api/settings (blockedProviders update from the NoAuth providers section unblock action) fails. The UI applied the optimistic unblock first; this error means the server rejected the write, leaving local and persisted state divergent until reload.

Solutions

  1. Retry the unblock action
  2. Reload the settings page to resync optimistic state
  3. Check the PATCH payload against the settings Zod schema
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/providers/components/NoAuthProvidersSection.tsx:76 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/397093dd9176b4ec. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/providers/components/NoAuthProvidersSection.tsx:76

  onToggleProvider,
}: NoAuthProvidersSectionProps) {
  const t = useTranslations("providers");

  const handleUnblock = async (providerId: string) => {
    const alias = getProviderAlias(providerId);
    const keysToRemove = new Set([providerId, alias].filter(Boolean) as string[]);
    const previous = blockedProviders;
    const next = previous.filter((p) => !keysToRemove.has(p));
    onBlockedChange(next);
    try {
      const response = await fetch("/api/settings", {
        method: "PATCH",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ blockedProviders: next }),
      });
      const data = await response.json().catch(() => ({}));
      if (!response.ok) {
        throw new Error(data?.error?.message || data?.error || "Failed to update provider");
      }
      onBlockedChange(Array.isArray(data.blockedProviders) ? data.blockedProviders : next);
    } catch (error) {
      onBlockedChange(previous);
      onError(error instanceof Error ? error.message : t("repairEnvFailed"));
    }
  };

  return (
    <div className="flex flex-col gap-4">
      <div className="flex flex-wrap items-center gap-2">
        <h2 className="text-xl font-semibold flex items-center gap-2 flex-1 min-w-0">
          {t("noAuthProviders")}{" "}
          <span className="size-2.5 rounded-full bg-stone-500" title={t("noAuthLabel")} />
          <ProviderCountBadge {...count} />
        </h2>
        <button
          onClick={() => onBatchTest("no-auth")}

View on GitHub (pinned to a179ffed5b)