apache/superset · error · ImportFailedError

A chart already exists and user doesn't have permissions to

Error message

A chart already exists and user doesn't have permissions to overwrite it

What it means

Raised as ImportFailedError by _ensure_can_edit_existing_chart during an overwrite import: a chart with the same UUID already exists, but the importing user either cannot access it (can_access_chart fails) or is not an editor/owner (is_editor fails). Overwrite mode reuses the existing row, so the caller must be allowed to modify that row.

Source

Thrown at superset/commands/chart/importers/v1/utils.py:57

      annotation layers objects.
    """
    params = chart_config.get("params", {})
    als = params.get("annotation_layers", [])
    params["annotation_layers"] = [
        al for al in als if al.get("annotationType") == AnnotationType.FORMULA
    ]


def _ensure_can_edit_existing_chart(
    existing: Slice,
    user: Any,
    error_message: str,
) -> None:
    if user and (
        not security_manager.can_access_chart(existing)
        or not security_manager.is_editor(existing)
    ):
        raise ImportFailedError(error_message)


def _restore_existing_chart_for_import(
    existing: Slice,
    config: dict[str, Any],
    can_write: bool,
    user: Any,
) -> None:
    # RESTORE path — re-importing a soft-deleted UUID is an implicit
    # restore-with-update, a distinct operation from overwriting an
    # alive row, so it is handled in its own branch.
    if not can_write:
        # Case B: don't silently return a soft-deleted row to a caller
        # without write permission — that would let the dashboard
        # importer reattach to a deleted chart and produce a broken
        # dashboard.
        # Name the chart: a dashboard bundle imports many charts, and
        # without the identity the operator can't tell which of N

View on GitHub (pinned to f4587218dd)

Solutions

  1. Import with overwrite=false so a new chart is created instead of modifying the existing one (requires create permission).
  2. Have the existing chart's owner (or an Admin) run the import.
  3. Add the importing user as an owner of the existing chart, then retry overwrite=true.
  4. Change the bundle's UUID to avoid the collision.

Example fix

# before
client.post('/api/v1/chart/import/', data={'overwrite': True}, ...)
# -> ImportFailedError: A chart already exists and user doesn't have permissions to overwrite it

# after: import as new chart instead of overwriting
client.post('/api/v1/chart/import/', data={'overwrite': False}, ...)
Defensive patterns

Strategy: validation

Validate before calling

from superset import security_manager
existing = find_existing_for_import(Slice, config['uuid'])
if existing and overwrite:
    assert security_manager.can_access_chart(existing) and security_manager.is_editor(existing), \
        'cannot overwrite existing chart'

Try / catch

from superset.commands.importers.exceptions import ImportFailedError
try:
    import_chart(...)
except ImportFailedError as ex:
    if 'permissions to overwrite' in str(ex):
        retry_with_overwrite_false_or_owner()

Prevention

When it happens

Trigger: POST /api/v1/chart/import/ with overwrite=true where the UUID matches an existing chart owned by someone else and the user's role lacks chart edit rights; importing into a workspace whose RBAC restricts chart editing to owners.

Common situations: Team A importing a bundle that collides with Team B's chart of the same UUID; Gamma users importing shared exports without can_write.

Related errors


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