{"record":{"id":"72237c9598c3044c","repo":"diegosouzapw/OmniRoute","slug":"failed-to-remove-wildcard-alias","errorCode":null,"errorMessage":"Failed to remove wildcard alias","messagePattern":"Failed to remove wildcard alias","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/app/(dashboard)/dashboard/settings/components/ModelAliasesUnified.tsx","lineNumber":162,"sourceCode":"  const removeWildcardAlias = async (index: number) => {\n    setSaving(true);\n    try {\n      const settingsRes = await fetch(\"/api/settings\", { cache: \"no-store\" });\n      if (!settingsRes.ok) throw new Error(\"Failed to load current settings\");\n      const settingsData = await settingsRes.json();\n      const revision =\n        typeof settingsData.settingsRevision === \"number\" ? settingsData.settingsRevision : 0;\n      const currentWildcards = Array.isArray(settingsData.wildcardAliases)\n        ? settingsData.wildcardAliases\n        : wildcardAliases;\n      const updated = currentWildcards.filter((_, currentIndex) => currentIndex !== index);\n      const res = await fetch(\"/api/settings\", {\n        method: \"PATCH\",\n        headers: { \"Content-Type\": \"application/json\" },\n        body: JSON.stringify({ wildcardAliases: updated, expectedRevision: revision }),\n      });\n      if (res.status === 409) throw new Error(\"Settings conflict — refresh and retry\");\n      if (!res.ok) throw new Error(\"Failed to remove wildcard alias\");\n      setWildcardAliases(updated);\n      showStatus(\"success\", translateOrFallback(t, \"saved\", \"Saved\"));\n    } catch (error) {\n      console.error(\"Failed to remove wildcard alias:\", error);\n      showStatus(\"error\", translateOrFallback(t, \"errorOccurred\", \"An error occurred\"));\n    } finally {\n      setSaving(false);\n    }\n  };\n\n  const handleAdd = async () => {\n    if (aliasMode === \"wildcard\") {\n      await addWildcardAlias();\n      return;\n    }\n    await addExactAlias();\n  };\n","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/app/(dashboard)/dashboard/settings/components/ModelAliasesUnified.tsx#L144-L180","documentation":"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.","triggerScenarios":"Thrown at src/app/(dashboard)/dashboard/settings/components/ModelAliasesUnified.tsx:162 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry after confirming GET /api/settings succeeds — a failed read aborts before the PATCH","Check server logs for why the PATCH of wildcardAliases was rejected (revision conflict, validation)","Reload the tab to resync the local list with the persisted one before retrying"],"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"}