{"record":{"id":"eed1550cf2c671fc","repo":"diegosouzapw/OmniRoute","slug":"failed-to-save-exact-alias","errorCode":null,"errorMessage":"Failed to save exact alias","messagePattern":"Failed to save exact alias","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/app/(dashboard)/dashboard/settings/components/ModelAliasesUnified.tsx","lineNumber":75,"sourceCode":"\n    loadAliases();\n  }, []);\n\n  const showStatus = (type: \"success\" | \"error\", message: string) => {\n    setStatus({ type, message });\n    setTimeout(() => setStatus({ type: \"\", message: \"\" }), 2500);\n  };\n\n  const addExactAlias = async () => {\n    if (!fromValue.trim() || !toValue.trim()) return;\n    setSaving(true);\n    try {\n      const res = await fetch(\"/api/settings/model-aliases\", {\n        method: \"POST\",\n        headers: { \"Content-Type\": \"application/json\" },\n        body: JSON.stringify({ from: fromValue.trim(), to: toValue.trim() }),\n      });\n      if (!res.ok) throw new Error(\"Failed to save exact alias\");\n      const data = await res.json();\n      setCustomAliases(data.custom || {});\n      setFromValue(\"\");\n      setToValue(\"\");\n      showStatus(\"success\", translateOrFallback(t, \"saved\", \"Saved\"));\n    } catch (error) {\n      console.error(\"Failed to save exact alias:\", error);\n      showStatus(\"error\", translateOrFallback(t, \"errorOccurred\", \"An error occurred\"));\n    } finally {\n      setSaving(false);\n    }\n  };\n\n  const removeExactAlias = async (from: string) => {\n    setSaving(true);\n    try {\n      const res = await fetch(\"/api/settings/model-aliases\", {\n        method: \"DELETE\",","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/app/(dashboard)/dashboard/settings/components/ModelAliasesUnified.tsx#L57-L93","documentation":"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.","triggerScenarios":"Thrown at src/app/(dashboard)/dashboard/settings/components/ModelAliasesUnified.tsx:75 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure 'from' is non-empty and not already aliased","Retry the save","Check /api/settings/model-aliases logs for the rejection"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}