diegosouzapw/OmniRoute · error · Error

Failed to save exact alias

Error message

Failed to save exact alias

What it means

addExactAlias' POST to /api/settings/model-aliases ({from, to} exact alias) returned non-OK; 'Failed to save exact alias' is thrown. The catch then logs and shows the localized generic errorOccurred status — duplicate aliases and invalid pairs surface through this same throw.

Solutions

  1. Ensure 'from' is non-empty and not already aliased
  2. Retry the save
  3. Check /api/settings/model-aliases logs for the rejection
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

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

    loadAliases();
  }, []);

  const showStatus = (type: "success" | "error", message: string) => {
    setStatus({ type, message });
    setTimeout(() => setStatus({ type: "", message: "" }), 2500);
  };

  const addExactAlias = async () => {
    if (!fromValue.trim() || !toValue.trim()) return;
    setSaving(true);
    try {
      const res = await fetch("/api/settings/model-aliases", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ from: fromValue.trim(), to: toValue.trim() }),
      });
      if (!res.ok) throw new Error("Failed to save exact alias");
      const data = await res.json();
      setCustomAliases(data.custom || {});
      setFromValue("");
      setToValue("");
      showStatus("success", translateOrFallback(t, "saved", "Saved"));
    } catch (error) {
      console.error("Failed to save exact alias:", error);
      showStatus("error", translateOrFallback(t, "errorOccurred", "An error occurred"));
    } finally {
      setSaving(false);
    }
  };

  const removeExactAlias = async (from: string) => {
    setSaving(true);
    try {
      const res = await fetch("/api/settings/model-aliases", {
        method: "DELETE",

View on GitHub (pinned to a179ffed5b)