Bug description
I create datasources/dashboards backup using commands "superset export-dashboards", "superset export-datasources". But when I try to import "superset import-datasources -p file.zip -u admin" or "superset import-dashboards -p file.zip -u admin" I get this error:
2025-04-02 09:20:12,779:INFO:superset.commands.dashboard.importers.dispatcher:Command failed validation 2025-04-02 09:20:12,779:ERROR:superset.cli.importexport:There was an error when importing the dashboards(s), please check the exception traceback in the log Traceback (most recent call last): File "/app/superset/cli/importexport.py", line 158, in import_dashboards ImportDashboardsCommand(contents, overwrite=True).run() File "/app/superset/commands/dashboard/importers/dispatcher.py", line 57, in run command.run() File "/app/superset/utils/decorators.py", line 266, in wrapped return on_error(ex) File "/app/superset/utils/decorators.py", line 236, in on_error raise ex File "/app/superset/utils/decorators.py", line 259, in wrapped result = func(args, *kwargs) File "/app/superset/commands/importers/v1/init.py", line 73, in run self.validate() File "/app/superset/commands/importers/v1/init.py", line 107, in validate raise CommandInvalidError( superset.commands.exceptions.CommandInvalidError: Error importing dashboard
If zip file contains some breaking resource/chart, why the program could not pass that and fails?
Screenshots/recordings
No response
Superset version
4.1.2
Python version
3.10
Node version
I don't know
Browser
Chrome
Additional context
No response
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.
Comment From: dosubot[bot]
A similar issue was reported and resolved by examining the HTTP response JSON in the browser's debugging console. The error was related to incorrect values assigned to the template_params
parameter during the export. The solution involved unzipping the exported dashboard file, searching for the problematic field in the YAML files, and replacing the value ''
with null
for template_params
. After compressing the directory back into a zip file, the import was successful [1].
In your case, the error might be due to validation errors in the metadata or configuration files within the zip. Ensure that: - The zip file contains a valid metadata file. - All configuration files within the zip adhere to the expected schemas and contain valid data. - The file format is compatible with one of the supported import command versions.
If the error persists, review the specific validation errors provided in the exception message to identify and correct the issues in the zip file contents [2].
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
Comment From: kirmorozov1992
A similar issue was reported and resolved by examining the HTTP response JSON in the browser's debugging console. The error was related to incorrect values assigned to the
template_params
parameter during the export. The solution involved unzipping the exported dashboard file, searching for the problematic field in the YAML files, and replacing the value''
withnull
fortemplate_params
. After compressing the directory back into a zip file, the import was successful [1].In your case, the error might be due to validation errors in the metadata or configuration files within the zip. Ensure that:
- The zip file contains a valid metadata file.
- All configuration files within the zip adhere to the expected schemas and contain valid data.
- The file format is compatible with one of the supported import command versions.
If the error persists, review the specific validation errors provided in the exception message to identify and correct the issues in the zip file contents [2].
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
It is strange. Why should I watch every file and search some value? It is ok, if I have a few objects. But what if I have thounsands of charts and datasets. I want to extract one big package and import it to another superset instance. If package has broken objects, it is good to pass thas, that is all. I noticed that the import error occurs when some chart doesn`t have parent dataset (dataset was deleted), for example. It would be good, if the import process pass that and continue.
Comment From: sadpandajoe
Looking at the CLI, looks like this was the original intended behavior to fail if we run into any errors. Feels like if we want this to change, it'll probably be a feature request. I don't think a SIP is required if we do this, but it'll need to parity the UI if we do this.
Comment From: msyavuz
Moving this to discussion since it seems like a feature request.