{"record":{"id":"58401808831c626f","repo":"apache/superset","slug":"dataset-column-not-found","errorCode":null,"errorMessage":"Dataset column not found.","messagePattern":"Dataset column not found\\.","errorType":"http","errorClass":"DatasetColumnNotFoundError","httpStatus":500,"severity":"error","filePath":"superset/commands/dataset/columns/delete.py","lineNumber":52,"sourceCode":"\n\nclass DeleteDatasetColumnCommand(BaseCommand):\n    def __init__(self, dataset_id: int, model_id: int):\n        self._dataset_id = dataset_id\n        self._model_id = model_id\n        self._model: Optional[TableColumn] = None\n\n    @transaction(on_error=partial(on_error, reraise=DatasetColumnDeleteFailedError))\n    def run(self) -> None:\n        self.validate()\n        assert self._model\n        DatasetColumnDAO.delete([self._model])\n\n    def validate(self) -> None:\n        # Validate/populate model exists\n        self._model = DatasetDAO.find_dataset_column(self._dataset_id, self._model_id)\n        if not self._model:\n            raise DatasetColumnNotFoundError()\n        # Check editorship\n        try:\n            security_manager.raise_for_editorship(self._model)\n        except SupersetSecurityException as ex:\n            raise DatasetColumnForbiddenError() from ex\n","sourceCodeStart":34,"sourceCodeEnd":58,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/dataset/columns/delete.py#L34-L58","documentation":"DatasetColumnNotFoundError (HTTP 404, 'Dataset column not found.') is raised by the delete-dataset-column command when DatasetDAO.find_dataset_column(dataset_id, column_id) returns None — the requested column id does not exist within the given dataset. The lookup is scoped to the pair, so a column id that exists in a different dataset also raises this.","triggerScenarios":"DELETE /api/v1/dataset/<dataset_id>/column/<column_id> where the column was already deleted, the id belongs to another dataset, or the dataset id is wrong. Also occurs when two actors delete the same column concurrently and the second request finds it gone.","commonSituations":"Stale UI state (column list fetched before another user/session removed the column); scripts reusing column ids after a dataset refresh changed columns; dataset metadata out of sync with the physical table.","solutions":["Re-fetch the dataset columns (GET /api/v1/dataset/<dataset_id>/_columns or the dataset detail) and confirm the column id still exists under that dataset.","If the dataset changed, refresh its metadata (POST /api/v1/dataset/<id>/refresh) and retry with the current column ids.","Treat 404 as success for idempotent delete flows (the end state — column absent — is already achieved)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# Confirm the column belongs to the dataset before deleting\nfrom superset.daos.dataset import DatasetDAO\n\ndef column_in_dataset(dataset_id: int, column_id: int) -> bool:\n    return DatasetDAO.find_dataset_column(dataset_id, column_id) is not None","typeGuard":null,"tryCatchPattern":"from superset.commands.dataset.columns.exceptions import DatasetColumnNotFoundError\ntry:\n    DeleteDatasetColumnCommand(dataset_id, column_id).run()\nexcept DatasetColumnNotFoundError:\n    pass  # idempotent delete: the end state (column absent) already holds","preventionTips":["Re-fetch the column list right before mutating; don't reuse ids captured pages ago.","Make delete flows idempotent by swallowing 404 on the specific resource.","After dataset schema changes on the source table, refresh dataset metadata so ids stay current."],"tags":["dataset","column","not-found","flask-api"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}