{"record":{"id":"b4c54f62bd5f0bdc","repo":"apache/superset","slug":"dashboard-not-found-b4c54f","errorCode":null,"errorMessage":"Dashboard not found","messagePattern":"Dashboard not found","errorType":"exception","errorClass":"DashboardUpdateFailedError","httpStatus":500,"severity":"error","filePath":"superset/daos/dashboard.py","lineNumber":569,"sourceCode":"        native_filter_configuration = metadata.get(\"native_filter_configuration\", [])\n\n        tab_filters = defaultdict(list)\n        for filter in native_filter_configuration:\n            if tabs_in_scope := filter.get(\"tabsInScope\", []):\n                for tab_key in tabs_in_scope:\n                    tab_filters[tab_key].append(filter)\n            tab_filters[\"all\"].append(filter)\n\n        return tab_filters\n\n    @classmethod\n    def update_native_filters_config(\n        cls,\n        dashboard: Dashboard | None = None,\n        attributes: dict[str, Any] | None = None,\n    ) -> list[dict[str, Any]]:\n        if not dashboard:\n            raise DashboardUpdateFailedError(\"Dashboard not found\")\n\n        if attributes:\n            try:\n                _parsed = json.loads(dashboard.json_metadata or \"{}\")\n            except (json.JSONDecodeError, TypeError):\n                _parsed = {}\n            metadata = _parsed if isinstance(_parsed, dict) else {}\n            native_filter_configuration = metadata.get(\n                \"native_filter_configuration\", []\n            )\n            reordered_filter_ids: list[int] = attributes.get(\"reordered\", [])\n            deleted_ids = set(attributes.get(\"deleted\", []))\n            modified_map = {f.get(\"id\"): f for f in attributes.get(\"modified\", [])}\n            updated_configuration = []\n\n            # Modify / Delete existing filters\n            for conf in native_filter_configuration:\n                conf_id = conf.get(\"id\")","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/daos/dashboard.py#L551-L587","documentation":"DashboardUpdateFailedError('Dashboard not found') raised by DashboardDAO.update_native_filters_config when called with dashboard=None (the function's guard for a missing dashboard argument). It is a control-flow guard inside native-filter reordering/deletion handling, not a query result — the caller passed no dashboard object.","triggerScenarios":"Internal/extension code invoking update_native_filters_config(dashboard=None, attributes={...}) — e.g. a dashboard API path where the dashboard failed to load upstream and None was forwarded instead of raising earlier.","commonSituations":"Custom plugins or fork code calling the DAO method directly without resolving the Dashboard first; refactors that moved dashboard fetching but kept the None default.","solutions":["Resolve the Dashboard first: dash = DashboardDAO.get_by_id_or_slug(id_or_slug), handling its NotFound/AccessDenied errors, then pass it in.","Do not forward None from upstream callers — fail at the fetch site.","Catch DashboardUpdateFailedError in the API layer and map it to 404 for the client."],"exampleFix":"# before\nDashboardDAO.update_native_filters_config(None, {\"reordered\": [2, 1]})\n\n# after\ndash = DashboardDAO.get_by_id_or_slug(id_or_slug)  # raises its own errors if absent\nDashboardDAO.update_native_filters_config(dash, {\"reordered\": [2, 1]})","handlingStrategy":"type-guard","validationCode":"def has_dashboard_arg(dashboard) -> bool:\n    return dashboard is not None","typeGuard":"def is_resolved_dashboard(obj) -> bool:\n    from superset.models.dashboard import Dashboard\n    return isinstance(obj, Dashboard) and obj.id is not None","tryCatchPattern":"try:\n    DashboardDAO.update_native_filters_config(dash, attributes)\nexcept DashboardUpdateFailedError as ex:\n    if 'not found' in str(ex):\n        abort(404)\n    raise","preventionTips":["Never forward None dashboards into DAO write methods — resolve and fail at the fetch site.","Map DashboardUpdateFailedError to a 404 in API handlers."],"tags":["dao","dashboard","native-filters","validation"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}