{"record":{"id":"2f7a418baca923df","repo":"apache/superset","slug":"name-already-exists-name-2f7a41","errorCode":null,"errorMessage":"Name already exists: {name}","messagePattern":"Name already exists: (.+?)","errorType":"validation","errorClass":"SemanticLayerInvalidError","httpStatus":422,"severity":"error","filePath":"superset/commands/semantic_layer/update.py","lineNumber":121,"sourceCode":"        )\n    )\n    def run(self) -> Model:\n        self.validate()\n        assert self._model\n        if isinstance(self._properties.get(\"configuration\"), dict):\n            self._properties[\"configuration\"] = json.dumps(\n                self._properties[\"configuration\"]\n            )\n        return SemanticLayerDAO.update(self._model, attributes=self._properties)\n\n    def validate(self) -> None:\n        self._model = SemanticLayerDAO.find_by_uuid(self._uuid)\n        if not self._model:\n            raise SemanticLayerNotFoundError()\n\n        name = self._properties.get(\"name\")\n        if name and not SemanticLayerDAO.validate_update_uniqueness(self._uuid, name):\n            raise SemanticLayerInvalidError(f\"Name already exists: {name}\")\n\n        if configuration := self._properties.get(\"configuration\"):\n            sl_type = self._model.type\n            cls = registry[sl_type]\n            cls.from_configuration(configuration)\n","sourceCodeStart":103,"sourceCodeEnd":127,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/semantic_layer/update.py#L103-L127","documentation":"Raised by UpdateSemanticLayerCommand.validate() (superset/commands/semantic_layer/update.py:121) as SemanticLayerInvalidError when the request includes a non-empty 'name' and SemanticLayerDAO.validate_update_uniqueness(self._uuid, name) returns false. Semantic layer names are globally unique (scoped to the layer's own UUID so unchanged names pass); renaming a layer to an existing name is rejected.","triggerScenarios":"PATCHing a semantic layer with {\"name\": X} where another layer already has name X; importing/migrating layers that collide on name.","commonSituations":"Renaming to a display name already used by a teammate's layer, or restoring a layer from a backup while the original still exists.","solutions":["List existing semantic layers and pick an unused name before the rename","Delete or rename the conflicting layer first if the goal is to reclaim the name","Suffix names (e.g. '-v2') when intentionally duplicating setups"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from superset.daos.semantic_layer import SemanticLayerDAO\n\nif name and not SemanticLayerDAO.validate_update_uniqueness(layer_uuid, name):\n    raise ValueError(f\"layer name '{name}' already taken\")","typeGuard":null,"tryCatchPattern":"try:\n    UpdateSemanticLayerCommand(uuid, {\"name\": new_name}).run()\nexcept SemanticLayerInvalidError as ex:\n    if \"already exists\" in str(ex):\n        # choose another name and resubmit\n        ","preventionTips":["Offer unique-name suggestions in rename UIs","Treat 'Name already exists' as a validation message, not a server fault"],"tags":["semantic-layer","uniqueness","rename","validation"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}