diegosouzapw/OmniRoute · error · Error

Failed to remove wildcard alias

Error message

Failed to remove wildcard alias

What it means

Generic sentinel thrown when removing a wildcard alias fails: removeWildcardAlias() re-fetches /api/settings, filters out the entry at the given index, and the follow-up PATCH to persist the shortened list returns non-ok or the flow throws earlier (e.g. the initial GET fails with 'Failed to load current settings'). The alias is still present server-side.

Solutions

  1. Retry after confirming GET /api/settings succeeds — a failed read aborts before the PATCH
  2. Check server logs for why the PATCH of wildcardAliases was rejected (revision conflict, validation)
  3. Reload the tab to resync the local list with the persisted one before retrying
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/settings/components/ModelAliasesUnified.tsx:162 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/72237c9598c3044c. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/settings/components/ModelAliasesUnified.tsx:162

  const removeWildcardAlias = async (index: number) => {
    setSaving(true);
    try {
      const settingsRes = await fetch("/api/settings", { cache: "no-store" });
      if (!settingsRes.ok) throw new Error("Failed to load current settings");
      const settingsData = await settingsRes.json();
      const revision =
        typeof settingsData.settingsRevision === "number" ? settingsData.settingsRevision : 0;
      const currentWildcards = Array.isArray(settingsData.wildcardAliases)
        ? settingsData.wildcardAliases
        : wildcardAliases;
      const updated = currentWildcards.filter((_, currentIndex) => currentIndex !== index);
      const res = await fetch("/api/settings", {
        method: "PATCH",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ wildcardAliases: updated, expectedRevision: revision }),
      });
      if (res.status === 409) throw new Error("Settings conflict — refresh and retry");
      if (!res.ok) throw new Error("Failed to remove wildcard alias");
      setWildcardAliases(updated);
      showStatus("success", translateOrFallback(t, "saved", "Saved"));
    } catch (error) {
      console.error("Failed to remove wildcard alias:", error);
      showStatus("error", translateOrFallback(t, "errorOccurred", "An error occurred"));
    } finally {
      setSaving(false);
    }
  };

  const handleAdd = async () => {
    if (aliasMode === "wildcard") {
      await addWildcardAlias();
      return;
    }
    await addExactAlias();
  };

View on GitHub (pinned to a179ffed5b)