ARBS-23 opened a new issue, #44304:
URL: https://github.com/apache/superset/issues/44304
### Bug description
Importing a dashboard whose **slug already exists on a different dashboard**
fails with a generic Import Error that tells the user the file is bad, instead
of saying the slug is already taken.
This is misleading: the ZIP is valid. The import hits the unique
`dashboards.slug` constraint, then that `IntegrityError` is swallowed by
`ImportModelsCommand.run()` and re-raised as `DashboardImportError` with the
generic message:
> Import dashboard failed for an unknown reason
The Import modal then wraps it as:
> An error occurred while importing dashboard: Import dashboard failed for
an unknown reason. Please re-export your file and try importing again
That last sentence is wrong for this case. Re-exporting does not help. The
user needs to change the imported slug, rename/delete the existing dashboard,
or overwrite the existing one.
Overwrite confirmation (`alreadyExists` / type `OVERWRITE`) is driven by
**UUID** in `_prevent_overwrite_existing_model()`, not by slug. A new UUID with
a colliding slug therefore never gets the overwrite UI; it falls through to
insert and the unique-constraint error.
`DashboardSlugExistsValidationError` ("Must be unique") already exists for
create/update, but dashboard import does not use it.
### How to reproduce the bug
1. Log in as a user who can create/import dashboards.
2. Open **Dashboards**.
3. Confirm an existing dashboard already has a slug (example:
`default-dashboard-2`).
4. Click **Import** and upload a dashboard ZIP whose YAML `slug` is that
same value, but whose dashboard **UUID is different**.
5. Confirm the import (do not type OVERWRITE; the overwrite field is not
shown).
### Screenshots/recordings
<img width="854" height="762" alt="Import Error modal showing generic
unknown-reason message"
src="https://github.com/user-attachments/assets/b450f48b-8822-4f1d-be20-c7afad6fb9ce"
/>
### Expected behavior
Surface a specific, actionable error, for example:
> This slug already exists in another dashboard.
Alternatively, treat a slug collision like an existing-resource conflict:
show the overwrite confirmation (`You are importing one or more dashboards that
already exist…` / type `OVERWRITE`) instead of a generic failure.
Do **not** ask the user to re-export the file when the ZIP is valid and the
only problem is a slug uniqueness conflict.
### Actual behavior
The Import modal shows:
**Import Error**
An error occurred while importing dashboard: Import dashboard failed for an
unknown reason. Please re-export your file and try importing again
No mention of slug uniqueness. No overwrite prompt.
### Superset version
6.1.0 (also observed on a deployment based on `apache/superset:6.1.0-py311`)
### Python version
3.11
### Node version
18 or greater
### Browser
Chrome
### Additional context
- OS: Windows 10
- Role: user with dashboard import permission
- ZIP export format (not legacy JSON)
- Backend wrapper:
[`DashboardImportError`](https://github.com/apache/superset/blob/6.1.0/superset/commands/dashboard/exceptions.py)
message is hardcoded to `"Import dashboard failed for an unknown reason"`.
`ImportModelsCommand.run()` catches any non-`CommandException` and raises
`self.import_error()`
([`superset/commands/importers/v1/__init__.py`](https://github.com/apache/superset/blob/6.1.0/superset/commands/importers/v1/__init__.py)).
- Overwrite gate is UUID-only: `_prevent_overwrite_existing_model()`
compares `config["uuid"]` against existing dashboard UUIDs; slug is not checked.
- Slug uniqueness is already validated on create/update via
`DashboardSlugExistsValidationError`.
- Distinct from https://github.com/apache/superset/issues/19222, which
collected many unrelated causes of the same generic message. Maintainers asked
for new issues with a specific root cause.
- Related: https://github.com/apache/superset/issues/36116 ([SIP-191]
improving import error logging / surfacing validation details)
- Internal tracker (optional): gigaphoton/fabscape-superset#138
### Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to
my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug
report.
- [x] I have checked Superset's logs for errors and if I found a relevant
Python stacktrace, I included it here as text in the "additional context"
section.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]