{"record":{"id":"633f6a773ff2a88b","repo":"apache/superset","slug":"semantic-view-does-not-exist","errorCode":null,"errorMessage":"Semantic view does not exist","messagePattern":"Semantic view does not exist","errorType":"exception","errorClass":"SemanticViewNotFoundError","httpStatus":404,"severity":"error","filePath":"superset/commands/semantic_layer/delete.py","lineNumber":84,"sourceCode":"        self._pk = pk\n        self._model: SemanticView | None = None\n\n    @transaction(\n        on_error=partial(\n            on_error,\n            catches=(SQLAlchemyError,),\n            reraise=SemanticViewDeleteFailedError,\n        )\n    )\n    def run(self) -> None:\n        self.validate()\n        assert self._model\n        SemanticViewDAO.delete([self._model])\n\n    def validate(self) -> None:\n        self._model = SemanticViewDAO.find_by_id(self._pk, id_column=\"id\")\n        if not self._model:\n            raise SemanticViewNotFoundError()\n        try:\n            security_manager.raise_for_editorship(self._model)\n        except SupersetSecurityException as ex:\n            raise SemanticViewForbiddenError() from ex\n\n\nclass BulkDeleteSemanticViewCommand(BaseCommand):\n    def __init__(self, model_ids: list[int]):\n        self._model_ids = model_ids\n        self._models: list[SemanticView] = []\n\n    @transaction(\n        on_error=partial(\n            on_error,\n            catches=(SQLAlchemyError,),\n            reraise=SemanticViewDeleteFailedError,\n        )\n    )","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/semantic_layer/delete.py#L66-L102","documentation":"Raised by DeleteSemanticViewCommand.validate() (superset/commands/semantic_layer/delete.py:84) when SemanticViewDAO.find_by_id(self._pk, id_column=\"id\") returns None. The single-view delete looks the view up by integer primary key; if no row matches, SemanticViewNotFoundError is raised before any authorization or deletion happens.","triggerScenarios":"DELETE on the semantic view endpoint with an integer id that does not exist; the view was removed by a concurrent request between the client loading the list and issuing the delete.","commonSituations":"Stale UI grid after another user deleted the view, replaying an old request, or passing a UUID where the integer id is expected.","solutions":["Confirm the id exists via the list/detail API before deleting","Handle 404 as idempotent success when the end goal is removal","Make sure you pass the integer 'id' field, not the view's 'uuid', to the delete endpoint"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from superset.daos.semantic_layer import SemanticViewDAO\n\nif SemanticViewDAO.find_by_id(view_id, id_column=\"id\") is None:\n    raise LookupError(f\"view {view_id} already gone\")","typeGuard":null,"tryCatchPattern":"try:\n    DeleteSemanticViewCommand(view_id).run()\nexcept SemanticViewNotFoundError:\n    pass  # already deleted; treat as success","preventionTips":["Use the integer id (not uuid) for the delete endpoint","Handle 404 idempotently in delete tooling"],"tags":["semantic-layer","semantic-view","not-found","delete"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}