apache/superset · error · ImportFailedError

A dashboard already exists and user doesn't have permissions

Error message

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

What it means

ImportFailedError('A dashboard already exists and user doesn't have permissions to overwrite it') is raised in the v1 import OVERWRITE branch: the bundle's UUID matches a live dashboard, overwrite mode is enabled and can_write holds, but the user cannot access the existing dashboard or is neither its editor nor an admin. Overwriting an alive row requires editorship of that specific dashboard, not just generic import rights.

Source

Thrown at superset/commands/dashboard/importers/v1/utils.py:421

            # though the upload was supposed to fix it.
            if "slug" in config:
                existing.slug = config["slug"]
            db.session.flush()
            config["id"] = existing.id
        else:
            # OVERWRITE path — existing alive row. Without ``overwrite`` or
            # write permission, return it unchanged (the pre-soft-delete
            # overwrite-without-permission behaviour).
            if not overwrite or not can_write:
                return existing
            if user and (
                not security_manager.can_access_dashboard(existing)
                or (
                    not security_manager.is_editor(existing)
                    and not security_manager.is_admin()
                )
            ):
                raise ImportFailedError(
                    "A dashboard already exists and user doesn't have "
                    "permissions to overwrite it"
                )
            config["id"] = existing.id
    elif not can_write:
        raise ImportFailedError(
            "Dashboard doesn't exist and user doesn't "
            "have permission to create dashboards"
        )

    # TODO (betodealmeida): move this logic to import_from_dict
    config = config.copy()

    # removed in https://github.com/apache/superset/pull/23228
    if "metadata" in config and "show_native_filters" in config["metadata"]:
        del config["metadata"]["show_native_filters"]

    # Note: theme_id handling moved to higher level import logic

View on GitHub (pinned to f4587218dd)

Solutions

  1. Add the importing user as an owner of the target dashboard (PUT /api/v1/dashboard/<id> with owners) before re-importing.
  2. Perform the overwrite import as an admin.
  3. Or import without overwrite into a new dashboard (change/remove the UUID) if divergence from the existing one is acceptable.

Example fix

# before
client.post('/api/v1/dashboard/import/', data={'overwrite': 'true'}, ...)  # not editor

# after
admin_client.put(f'/api/v1/dashboard/{id}', json={'owners': [user.id]})
client.post('/api/v1/dashboard/import/', data={'overwrite': 'true'}, files=...)
Defensive patterns

Strategy: try-catch

Validate before calling

existing = find_existing_for_import(Dashboard, config['uuid'])
user = get_user()
if existing is not None and existing.deleted_at is None and overwrite and user:
    if not security_manager.can_access_dashboard(existing) or (
        not security_manager.is_editor(existing)
        and not security_manager.is_admin()
    ):
        raise PermissionError('overwrite import requires editorship of the target dashboard')

Try / catch

try:
    run_import(bundle, overwrite=True)
except ImportFailedError as ex:
    if "permissions to overwrite" in str(ex):
        add_importer_as_owner(existing.id) or run_as_admin()

Prevention

When it happens

Trigger: Importing a v1 ZIP with overwrite=True whose dashboard UUID matches an existing live dashboard owned by someone else, while the importing user has import permission but not editorship of that dashboard.

Common situations: Central pipelines pushing updated dashboard bundles to environments where local teams own the dashboards; new team members re-importing shared bundles without being added as owners; cross-environment promotion tools using a generic import account.

Related errors


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