{"record":{"id":"115faab28576c6df","repo":"apache/superset","slug":"semantic-layer-does-not-exist-115faa","errorCode":null,"errorMessage":"Semantic layer does not exist","messagePattern":"Semantic layer does not exist","errorType":"exception","errorClass":"SemanticLayerNotFoundError","httpStatus":404,"severity":"error","filePath":"superset/commands/semantic_layer/update.py","lineNumber":117,"sourceCode":"        on_error=partial(\n            on_error,\n            catches=(SQLAlchemyError, ValueError),\n            reraise=SemanticLayerUpdateFailedError,\n        )\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":99,"sourceCodeEnd":127,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/semantic_layer/update.py#L99-L127","documentation":"Raised by UpdateSemanticLayerCommand.validate() (superset/commands/semantic_layer/update.py:117) when SemanticLayerDAO.find_by_uuid(self._uuid) returns None. The layer update command resolves the semantic layer by UUID first; a nonexistent UUID aborts with SemanticLayerNotFoundError before name-uniqueness or configuration validation runs.","triggerScenarios":"PATCH/PUT on the semantic layer endpoint with a UUID that was deleted or never existed; a truncated or mistyped UUID copied from an older API response.","commonSituations":"Client holds a stale UUID after the layer was recreated (new UUID), or scripts run against the wrong environment whose layers have different UUIDs.","solutions":["Re-fetch the semantic layer list to obtain the current UUID before updating","Treat the resulting 404 as a signal to refresh client state, not to blind-retry","Store the layer identifier from the same environment you are patching"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from superset.daos.semantic_layer import SemanticLayerDAO\n\nif SemanticLayerDAO.find_by_uuid(layer_uuid) is None:\n    raise LookupError(\"layer uuid stale; refetch the layer list\")","typeGuard":null,"tryCatchPattern":"try:\n    UpdateSemanticLayerCommand(layer_uuid, props).run()\nexcept SemanticLayerNotFoundError:\n    # refetch layers, then retry with the fresh uuid\n    ","preventionTips":["UUIDs change when layers are recreated; always read the uuid from a fresh list","Keep environment-specific UUIDs separate in scripts (dev vs prod)"],"tags":["semantic-layer","not-found","update","rest-api"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}