apache/superset · error · ImportFailedError
Chart doesn't exist and user doesn't have permission to crea
Error message
Chart doesn't exist and user doesn't have permission to create charts
What it means
Raised as ImportFailedError when the bundle contains no existing chart with that UUID (find_existing_for_import returns None) and the caller lacks can_write, which in the import flow doubles as the permission to create new charts. Without can_write the import cannot proceed on either the overwrite or create branch.
Source
Thrown at superset/commands/chart/importers/v1/utils.py:190
can_write = ignore_permissions or security_manager.can_access("can_write", "Chart")
# `user` is None for background / example-loader paths (no Flask request
# user). Combined with ``can_write=True`` (typically from
# ``ignore_permissions=True``), the editorship checks in the restore /
# overwrite branches below are intentionally skipped because the caller has
# already established trust at the command level.
user = get_user()
if existing := find_existing_for_import(Slice, config["uuid"]):
if existing_chart := _prepare_existing_chart_for_import(
existing,
config,
overwrite,
can_write,
user,
):
return existing_chart
elif not can_write:
raise ImportFailedError(
"Chart doesn't exist and user doesn't have permission to create charts"
)
filter_chart_annotations(config)
# TODO (betodealmeida): move this logic to import_from_dict
config["params"] = json.dumps(config["params"])
# migrate old viz types to new ones
config = migrate_chart(config)
chart = Slice.import_from_dict(config, recursive=False, allow_reparenting=True)
if chart.id is None:
db.session.flush()
# Only newly created charts inherit the creator's editor/viewer defaults;
# re-importing over an existing chart (overwrite or soft-delete restore)
# must not silently grant the importer's groups access. Mirrors theView on GitHub (pinned to f4587218dd)
Solutions
- Grant the importing user/role chart write (create) permission and retry.
- Run the import as Admin.
- Pre-create the chart (or a first import by an admin) so subsequent imports hit the overwrite path instead of create.
Example fix
# before
client.post('/api/v1/chart/import/', files=...) # ImportFailedError: ...no permission to create charts
# after: import with a role that has can_write on charts, e.g. Admin
admin_client.post('/api/v1/chart/import/', files=...) Defensive patterns
Strategy: validation
Validate before calling
if find_existing_for_import(Slice, config['uuid']) is None and not can_write:
raise PermissionError('importing new charts requires can_write') Try / catch
from superset.commands.importers.exceptions import ImportFailedError
try:
import_chart(...)
except ImportFailedError as ex:
if 'permission to create' in str(ex):
run_import_as_admin() Prevention
- Use an Admin or can_write role for first-time imports of a bundle.
- Pre-seed charts via an admin import so later imports hit the overwrite path.
When it happens
Trigger: POST /api/v1/chart/import/ into a workspace where the chart UUID is absent, performed by a user whose role has no chart create/write capability; also when overwrite=false and no implicit create rights exist.
Common situations: Gamma-level users importing shared chart bundles; service accounts missing the can_write chart permission; fresh environments where the bundle was never imported before.
Related errors
- A chart already exists and user doesn't have permissions to
- Chart {existing.slice_name!r} (uuid {config['uuid']}) was de
- Database doesn't exist and user doesn't have permission to c
- Could not find a valid command to import file
- Dashboard doesn't exist and user doesn't have permission to
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/137134e35c48aaa7.
Report an issue: GitHub.