apache/superset · error · SemanticViewNotFoundError

Semantic view does not exist

Error message

Semantic view does not exist

What it means

Raised by UpdateSemanticViewCommand.validate() (superset/commands/semantic_layer/update.py:67) when SemanticViewDAO.find_by_id(self._model_id) returns None. The update command must first load the existing semantic view row by integer id; if it does not exist, SemanticViewNotFoundError aborts before editorship and uniqueness checks run.

Source

Thrown at superset/commands/semantic_layer/update.py:67

        self._properties = data.copy()
        self._model: SemanticView | None = None

    @transaction(
        on_error=partial(
            on_error,
            catches=(SQLAlchemyError, ValueError),
            reraise=SemanticViewUpdateFailedError,
        )
    )
    def run(self) -> Model:
        self.validate()
        assert self._model
        return SemanticViewDAO.update(self._model, attributes=self._properties)

    def validate(self) -> None:
        self._model = SemanticViewDAO.find_by_id(self._model_id)
        if not self._model:
            raise SemanticViewNotFoundError()

        try:
            security_manager.raise_for_editorship(self._model)
        except SupersetSecurityException as ex:
            raise SemanticViewForbiddenError() from ex

        name = self._properties.get("name", self._model.name)
        layer_uuid = str(self._model.semantic_layer_uuid)
        configuration = self._properties.get(
            "configuration",
            json.loads(self._model.configuration),
        )
        if not SemanticViewDAO.validate_update_uniqueness(
            view_uuid=str(self._model.uuid),
            name=name,
            layer_uuid=layer_uuid,
            configuration=configuration,
        ):

View on GitHub (pinned to f4587218dd)

Solutions

  1. GET the view by id before opening the edit form; treat 404 as 'reopen the list'
  2. Refresh the client's copy of the view (and its id) before saving edits
  3. Confirm you are using the integer id, not the UUID, for the update endpoint
Defensive patterns

Strategy: validation

Validate before calling

from superset.daos.semantic_layer import SemanticViewDAO

if SemanticViewDAO.find_by_id(view_id) is None:
    raise LookupError(f"view {view_id} no longer exists; refresh the list")

Try / catch

try:
    UpdateSemanticViewCommand(view_id, props).run()
except SemanticViewNotFoundError:
    # discard local edits, reload the collection view
    

Prevention

When it happens

Trigger: PUT/PATCH on the semantic view endpoint with an integer id that was deleted; the row is gone due to a concurrent delete or the id came from a stale client cache.

Common situations: Editing a view in one tab while it is deleted in another; environments where the same view exists with different ids and the wrong one is used.

Related errors


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