{"record":{"id":"d457196d72e292ef","repo":"apache/superset","slug":"dashboard-doesn-t-exist-and-user-doesn-t-have-perm","errorCode":null,"errorMessage":"Dashboard doesn't exist and user doesn't have permission to create dashboards","messagePattern":"Dashboard doesn't exist and user doesn't have permission to create dashboards","errorType":"exception","errorClass":"ImportFailedError","httpStatus":500,"severity":"error","filePath":"superset/commands/dashboard/importers/v1/utils.py","lineNumber":427,"sourceCode":"            # OVERWRITE path — existing alive row. Without ``overwrite`` or\n            # write permission, return it unchanged (the pre-soft-delete\n            # overwrite-without-permission behaviour).\n            if not overwrite or not can_write:\n                return existing\n            if user and (\n                not security_manager.can_access_dashboard(existing)\n                or (\n                    not security_manager.is_editor(existing)\n                    and not security_manager.is_admin()\n                )\n            ):\n                raise ImportFailedError(\n                    \"A dashboard already exists and user doesn't have \"\n                    \"permissions to overwrite it\"\n                )\n            config[\"id\"] = existing.id\n    elif not can_write:\n        raise ImportFailedError(\n            \"Dashboard doesn't exist and user doesn't \"\n            \"have permission to create dashboards\"\n        )\n\n    # TODO (betodealmeida): move this logic to import_from_dict\n    config = config.copy()\n\n    # removed in https://github.com/apache/superset/pull/23228\n    if \"metadata\" in config and \"show_native_filters\" in config[\"metadata\"]:\n        del config[\"metadata\"][\"show_native_filters\"]\n\n    # Note: theme_id handling moved to higher level import logic\n\n    for key, new_name in JSON_KEYS.items():\n        if config.get(key) is not None:\n            value = config.pop(key)\n            try:\n                config[new_name] = json.dumps(value)","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/dashboard/importers/v1/utils.py#L409-L445","documentation":"ImportFailedError(\"Dashboard doesn't exist and user doesn't have permission to create dashboards\") is raised in the v1 import path when no existing dashboard matches the bundle's UUID and the importer lacks can_write (dashboard create/import permission). Importing a new dashboard is a create operation, so the role must carry dashboard write permission.","triggerScenarios":"Uploading a v1 dashboard ZIP for a UUID not present in the target instance, using a role without can_write/can_import on Dashboard (e.g. a viewer or dashboard-reader role).","commonSituations":"Sharing dashboard bundles with analysts whose roles only grant read access; import service accounts provisioned with minimal permissions; attempting first-time import into a fresh environment before granting the pipeline account creator rights.","solutions":["Grant the importing role 'can_write' (import) permission on Dashboards via Security -> Role editing.","Run the import under an account that already has dashboard-creation rights (e.g. Admin or a Curator role).","If creation should be centralized, route bundle imports through a service account with exactly dashboard can_write and nothing more."],"exampleFix":"# before\nclient.post('/api/v1/dashboard/import/', ...)  # viewer role, new UUID -> 403-equivalent\n\n# after\n# assign role with can_write on Dashboard to the importing user, then\nclient.post('/api/v1/dashboard/import/', files={'formData': open('dash.zip', 'rb')})","handlingStrategy":"validation","validationCode":"existing = find_existing_for_import(Dashboard, config['uuid'])\nif existing is None and not security_manager.can_access('can_write', 'Dashboard'):\n    raise PermissionError('importing a new dashboard requires can_write on Dashboard')","typeGuard":null,"tryCatchPattern":"try:\n    run_import(bundle)\nexcept ImportFailedError as ex:\n    if \"permission to create dashboards\" in str(ex):\n        grant_can_write_or_run_as_admin()","preventionTips":["Provision import service accounts with Dashboard can_write.","Verify the role's permission matrix before first import into a new environment.","Remember: new-UUID imports are creates and always need create rights."],"tags":["security","rbac","import","create","permissions"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}