apache/superset · error · ValueError

A semantic view with name '{name}' and the same configuratio

Error message

A semantic view with name '{name}' and the same configuration already exists in this semantic layer.

What it means

Raised by UpdateSemanticViewCommand.validate() (superset/commands/semantic_layer/update.py:86) as a ValueError when SemanticViewDAO.validate_update_uniqueness(view_uuid, name, layer_uuid, configuration) returns false. Uniqueness is enforced on update exactly as on create: no OTHER view in the same semantic layer may share the target name+configuration pair (the view's own uuid is excluded, so saving without changes is allowed). The effective name/configuration fall back to the model's current values when not supplied in the patch.

Source

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

        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,
        ):
            raise ValueError(
                f"A semantic view with name '{name}' and the same "
                "configuration already exists in this semantic layer."
            )


class UpdateSemanticLayerCommand(BaseCommand):
    def __init__(self, uuid: str, data: dict[str, Any]):
        self._uuid = uuid
        self._properties = data.copy()
        self._model: SemanticLayer | None = None

    @transaction(
        on_error=partial(
            on_error,
            catches=(SQLAlchemyError, ValueError),
            reraise=SemanticLayerUpdateFailedError,
        )
    )

View on GitHub (pinned to f4587218dd)

Solutions

  1. Before saving, list sibling views in the same semantic_layer_uuid and verify no other view has the target name+configuration pair
  2. Rename the view to something unique within the layer
  3. If you intend two identical views, differentiate at least the name or the configuration
Defensive patterns

Strategy: validation

Validate before calling

from superset.daos.semantic_layer import SemanticViewDAO

# exclude self (view_uuid) exactly like the server does
if not SemanticViewDAO.validate_update_uniqueness(
    view_uuid=str(view.uuid), name=new_name,
    layer_uuid=str(view.semantic_layer_uuid), configuration=new_config,
):
    raise ValueError("name+configuration collides with a sibling view")

Try / catch

try:
    UpdateSemanticViewCommand(view_id, props).run()
except ValueError as ex:
    if "already exists" in str(ex):
        # pick a different name or tweak configuration, then resubmit
        

Prevention

When it happens

Trigger: PATCHing a view's name to one already used by another view in the same layer with an equivalent configuration; PATCHing only 'configuration' to a value that collides with a sibling view that shares the same name.

Common situations: Renaming a view to a 'friendly' name that already exists, copying a view's configuration into a second view with the same name, or save-as flows that keep the name.

Related errors


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