diegosouzapw/OmniRoute · error · Error
Failed to save wildcard alias
Error message
Failed to save wildcard alias
What it means
Generic sentinel thrown when persisting a new wildcard model alias fails: the client re-fetches /api/settings (read-modify-write with settingsRevision), appends the new {pattern,target} pair locally, and the subsequent PATCH is rejected with a non-ok response or throws mid-flow. It does not say why the save failed — only that the wildcard pair was not committed to settings.
Solutions
- Retry the save after confirming the /api/settings route is healthy and returns 200
- Verify the pattern string is a well-formed wildcard alias and does not duplicate an existing entry
- Check that settingsRevision read from the GET was forwarded so the server accepts the optimistic-concurrency write
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src/app/(dashboard)/dashboard/settings/components/ModelAliasesUnified.tsx:131 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/6fc17081ad720ab6.
Report an issue: GitHub.
Appendix: source
Thrown at src/app/(dashboard)/dashboard/settings/components/ModelAliasesUnified.tsx:131
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,
{ pattern: fromValue.trim(), target: toValue.trim() },
];
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 save wildcard alias");
setWildcardAliases(updated);
setFromValue("");
setToValue("");
showStatus("success", translateOrFallback(t, "saved", "Saved"));
} catch (error) {
console.error("Failed to save wildcard alias:", error);
showStatus("error", translateOrFallback(t, "errorOccurred", "An error occurred"));
} finally {
setSaving(false);
}
};
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();View on GitHub (pinned to a179ffed5b)