{"record":{"id":"c78756ad71a06ad3","repo":"apache/superset","slug":"dashboard-not-found-c78756","errorCode":null,"errorMessage":"Dashboard not found.","messagePattern":"Dashboard not found\\.","errorType":"exception","errorClass":"DashboardNotFoundError","httpStatus":404,"severity":"warning","filePath":"superset/commands/dashboard/export_example.py","lineNumber":533,"sourceCode":"        dashboard.yaml    - Dashboard definition\n        charts/*.yaml     - Chart definitions\n    \"\"\"\n\n    def __init__(\n        self,\n        dashboard_id: int,\n        export_data: bool = True,\n        sample_rows: int | None = None,\n    ):\n        self._dashboard_id = dashboard_id\n        self._export_data = export_data\n        self._sample_rows = sample_rows\n        self._dashboard: Dashboard | None = None\n\n    def validate(self) -> None:\n        self._dashboard = DashboardDAO.find_by_id(self._dashboard_id)\n        if not self._dashboard:\n            raise DashboardNotFoundError()\n\n    def run(self) -> Iterator[tuple[str, Callable[[], bytes]]]:  # noqa: C901\n        \"\"\"Yield (filename, content_generator) tuples for ZIP packaging.\n\n        Content generators return bytes (either YAML encoded or raw Parquet).\n        \"\"\"\n        self.validate()\n        assert self._dashboard is not None\n\n        # Collect all charts and their datasets\n        charts = self._dashboard.slices\n        datasets: dict[int, SqlaTable] = {}\n        chart_id_to_uuid: dict[int, str] = {}\n        chart_to_dataset_uuid: dict[int, str] = {}\n\n        for chart in charts:\n            chart_id_to_uuid[chart.id] = str(chart.uuid)\n            if chart.datasource:","sourceCodeStart":515,"sourceCodeEnd":551,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/dashboard/export_example.py#L515-L551","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the id exists: GET /api/v1/dashboard/<id> or query DashboardDAO.find_by_id before export.","Look up the id by slug or title instead of hardcoding it across environments.","If examples are expected, re-run the example loader (superset load_examples) to recreate them."],"exampleFix":"# before\nExportExampleDashboardCommand(42).run()  # 42 not in this env\n\n# after\nfrom superset.daos.dashboard import DashboardDAO\ndash = DashboardDAO.find_by_id(42) or DashboardDAO.find_by_slug('sales')\nif dash:\n    ExportExampleDashboardCommand(dash.id).run()","handlingStrategy":"validation","validationCode":"from superset.daos.dashboard import DashboardDAO\n\ndash = DashboardDAO.find_by_id(dashboard_id)\nif dash is None:\n    dash = DashboardDAO.find_by_slug(slug)  # resolve per-environment\nif dash is None:\n    raise LookupError(f'dashboard {dashboard_id} not present in this environment')","typeGuard":null,"tryCatchPattern":"try:\n    list(ExportExampleDashboardCommand(dashboard_id).run())\nexcept DashboardNotFoundError:\n    logger.error('dashboard %s missing; resolve id by slug', dashboard_id)","preventionTips":["Resolve dashboard ids by slug or title per environment instead of hardcoding.","Guard export scripts with a find_by_id existence check.","Re-seed examples with load_examples in fresh environments."],"tags":["dashboard","export","not-found","examples"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}