apache/superset · error · DatasetColumnNotFoundError

Dataset column not found.

Error message

Dataset column not found.

What it means

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.

Source

Thrown at superset/commands/dataset/columns/delete.py:52


class DeleteDatasetColumnCommand(BaseCommand):
    def __init__(self, dataset_id: int, model_id: int):
        self._dataset_id = dataset_id
        self._model_id = model_id
        self._model: Optional[TableColumn] = None

    @transaction(on_error=partial(on_error, reraise=DatasetColumnDeleteFailedError))
    def run(self) -> None:
        self.validate()
        assert self._model
        DatasetColumnDAO.delete([self._model])

    def validate(self) -> None:
        # Validate/populate model exists
        self._model = DatasetDAO.find_dataset_column(self._dataset_id, self._model_id)
        if not self._model:
            raise DatasetColumnNotFoundError()
        # Check editorship
        try:
            security_manager.raise_for_editorship(self._model)
        except SupersetSecurityException as ex:
            raise DatasetColumnForbiddenError() from ex

View on GitHub (pinned to f4587218dd)

Solutions

  1. 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.
  2. If the dataset changed, refresh its metadata (POST /api/v1/dataset/<id>/refresh) and retry with the current column ids.
  3. Treat 404 as success for idempotent delete flows (the end state — column absent — is already achieved).
Defensive patterns

Strategy: try-catch

Validate before calling

# Confirm the column belongs to the dataset before deleting
from superset.daos.dataset import DatasetDAO

def column_in_dataset(dataset_id: int, column_id: int) -> bool:
    return DatasetDAO.find_dataset_column(dataset_id, column_id) is not None

Try / catch

from superset.commands.dataset.columns.exceptions import DatasetColumnNotFoundError
try:
    DeleteDatasetColumnCommand(dataset_id, column_id).run()
except DatasetColumnNotFoundError:
    pass  # idempotent delete: the end state (column absent) already holds

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/superset@f4587218dd (2026-08-14). Data as JSON: /api/errors/58401808831c626f. Report an issue: GitHub.