apache/superset · error · SemanticLayerNotFoundError

Semantic layer does not exist

Error message

Semantic layer does not exist

What it means

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.

Source

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

        on_error=partial(
            on_error,
            catches=(SQLAlchemyError, ValueError),
            reraise=SemanticLayerUpdateFailedError,
        )
    )
    def run(self) -> Model:
        self.validate()
        assert self._model
        if isinstance(self._properties.get("configuration"), dict):
            self._properties["configuration"] = json.dumps(
                self._properties["configuration"]
            )
        return SemanticLayerDAO.update(self._model, attributes=self._properties)

    def validate(self) -> None:
        self._model = SemanticLayerDAO.find_by_uuid(self._uuid)
        if not self._model:
            raise SemanticLayerNotFoundError()

        name = self._properties.get("name")
        if name and not SemanticLayerDAO.validate_update_uniqueness(self._uuid, name):
            raise SemanticLayerInvalidError(f"Name already exists: {name}")

        if configuration := self._properties.get("configuration"):
            sl_type = self._model.type
            cls = registry[sl_type]
            cls.from_configuration(configuration)

View on GitHub (pinned to f4587218dd)

Solutions

  1. Re-fetch the semantic layer list to obtain the current UUID before updating
  2. Treat the resulting 404 as a signal to refresh client state, not to blind-retry
  3. Store the layer identifier from the same environment you are patching
Defensive patterns

Strategy: validation

Validate before calling

from superset.daos.semantic_layer import SemanticLayerDAO

if SemanticLayerDAO.find_by_uuid(layer_uuid) is None:
    raise LookupError("layer uuid stale; refetch the layer list")

Try / catch

try:
    UpdateSemanticLayerCommand(layer_uuid, props).run()
except SemanticLayerNotFoundError:
    # refetch layers, then retry with the fresh uuid
    

Prevention

When it happens

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

Common situations: Client holds a stale UUID after the layer was recreated (new UUID), or scripts run against the wrong environment whose layers have different UUIDs.

Related errors


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