apache/superset · warning · DashboardNotFoundError

Dashboard not found.

Error message

Dashboard not found.

What it means

DashboardNotFoundError is raised by the export-example dashboard command's validate() when DashboardDAO.find_by_id(dashboard_id) returns None. The dashboard id requested for export (with optional data samples as Parquet) does not exist in the metadata database.

Source

Thrown at superset/commands/dashboard/export_example.py:533

        dashboard.yaml    - Dashboard definition
        charts/*.yaml     - Chart definitions
    """

    def __init__(
        self,
        dashboard_id: int,
        export_data: bool = True,
        sample_rows: int | None = None,
    ):
        self._dashboard_id = dashboard_id
        self._export_data = export_data
        self._sample_rows = sample_rows
        self._dashboard: Dashboard | None = None

    def validate(self) -> None:
        self._dashboard = DashboardDAO.find_by_id(self._dashboard_id)
        if not self._dashboard:
            raise DashboardNotFoundError()

    def run(self) -> Iterator[tuple[str, Callable[[], bytes]]]:  # noqa: C901
        """Yield (filename, content_generator) tuples for ZIP packaging.

        Content generators return bytes (either YAML encoded or raw Parquet).
        """
        self.validate()
        assert self._dashboard is not None

        # Collect all charts and their datasets
        charts = self._dashboard.slices
        datasets: dict[int, SqlaTable] = {}
        chart_id_to_uuid: dict[int, str] = {}
        chart_to_dataset_uuid: dict[int, str] = {}

        for chart in charts:
            chart_id_to_uuid[chart.id] = str(chart.uuid)
            if chart.datasource:

View on GitHub (pinned to f4587218dd)

Solutions

  1. Verify the id exists: GET /api/v1/dashboard/<id> or query DashboardDAO.find_by_id before export.
  2. Look up the id by slug or title instead of hardcoding it across environments.
  3. If examples are expected, re-run the example loader (superset load_examples) to recreate them.

Example fix

# before
ExportExampleDashboardCommand(42).run()  # 42 not in this env

# after
from superset.daos.dashboard import DashboardDAO
dash = DashboardDAO.find_by_id(42) or DashboardDAO.find_by_slug('sales')
if dash:
    ExportExampleDashboardCommand(dash.id).run()
Defensive patterns

Strategy: validation

Validate before calling

from superset.daos.dashboard import DashboardDAO

dash = DashboardDAO.find_by_id(dashboard_id)
if dash is None:
    dash = DashboardDAO.find_by_slug(slug)  # resolve per-environment
if dash is None:
    raise LookupError(f'dashboard {dashboard_id} not present in this environment')

Try / catch

try:
    list(ExportExampleDashboardCommand(dashboard_id).run())
except DashboardNotFoundError:
    logger.error('dashboard %s missing; resolve id by slug', dashboard_id)

Prevention

When it happens

Trigger: Invoking the example-dashboard export command/API with a dashboard id that is absent — a typo'd id, a dashboard from another environment, or one already deleted.

Common situations: Export scripts carrying hardcoded ids between environments (staging ids used against prod); exporting right after a metadata DB reset where example dashboards no longer exist; CI jobs that assume seeded examples.

Related errors


AI-assisted analysis of apache/superset@f4587218dd (2026-08-14). Data as JSON: /api/errors/c78756ad71a06ad3. Report an issue: GitHub.