apache/superset · warning · DashboardImportException
No data in file
Error message
No data in file
What it means
DashboardImportException('No data in file') is raised by the legacy v0 import_dashboards() when json.loads of the uploaded content produces an empty result. The v0 path expects a JSON payload (old-format export with 'datasources' and 'dashboards' keys); an empty object, empty array, or effectively empty JSON body triggers this before any processing.
Source
Thrown at superset/commands/dashboard/importers/v0.py:308
if "__SqlMetric__" in o:
return SqlMetric(**o["__SqlMetric__"])
if "__datetime__" in o:
return datetime.strptime(o["__datetime__"], "%Y-%m-%dT%H:%M:%S")
return o
def import_dashboards(
content: str,
database_id: Optional[int] = None,
import_time: Optional[int] = None,
) -> None:
"""Imports dashboards from a stream to databases"""
current_tt = int(time.time())
import_time = current_tt if import_time is None else import_time
data = json.loads(content, object_hook=decode_dashboards)
if not data:
raise DashboardImportException(_("No data in file"))
dataset_id_mapping: dict[int, int] = {}
# This legacy path creates/updates the embedded datasets. Mirror the
# versioned (v1) import commands and require dataset write permission for the
# objects being created here. Only enforced when there is something to import
# and a request user is present, so the CLI import paths keep working.
if (
data["datasources"]
and get_user()
and not security_manager.can_access("can_write", "Dataset")
):
raise ImportFailedError(
"User doesn't have permission to create or update datasets"
)
for table in data["datasources"]:
new_dataset_id = import_dataset(table, database_id, import_time=import_time)
params = json.loads(table.params)
dataset_id_mapping[params["remote_id"]] = new_dataset_id
View on GitHub (pinned to f4587218dd)
Solutions
- Inspect the file being imported: it must contain non-empty 'datasources' and 'dashboards' arrays in old v0 JSON format.
- Fix the upstream export step that produced an empty file (check its logs/status) before importing.
- Prefer the modern ZIP/YAML v1 export+import flow instead of the legacy JSON path.
Example fix
# before
import_dashboards(open('dashboards.json').read()) # file contains '{}'
# after
import json
data = json.loads(content)
if not data or not data.get('dashboards'):
raise ValueError('Export file is empty; regenerate it from the source instance')
import_dashboards(content) Defensive patterns
Strategy: validation
Validate before calling
import json
data = json.loads(content)
if not data or not data.get('dashboards'):
raise ValueError('legacy export file is empty; regenerate from source') Try / catch
try:
import_dashboards(content)
except DashboardImportException as ex:
if 'No data in file' in str(ex):
regenerate_export_file() Prevention
- Check export step exit status before piping its output into import.
- Prefer the v1 ZIP format over legacy JSON imports.
- Validate non-empty 'dashboards'/'datasources' arrays before calling the importer.
When it happens
Trigger: Uploading an empty JSON file or a file whose JSON root is falsy ({}, []) to the legacy dashboard import; feeding an old-format export that was truncated or reduced to an empty structure.
Common situations: Automation piping an empty or failed export into import; manual construction of v0 JSON files that ends up as {}; upstream fetch step silently failing and writing an empty file that is then imported.
Related errors
- Could not find a valid command to import file
- User doesn't have permission to create or update datasets
- No valid import files were found
- No dashboard found for uuid ${sourceUuid}
- A valid color scheme is required
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/29ae73739006eec1.
Report an issue: GitHub.