{"record":{"id":"6f8dc7ef0829ec98","repo":"apache/superset","slug":"dataset-schema-is-invalid-caused-by-error-s","errorCode":null,"errorMessage":"Dataset schema is invalid, caused by: %(error)s","messagePattern":"Dataset schema is invalid, caused by: (.+?)","errorType":"validation","errorClass":"DatasetValidationError","httpStatus":422,"severity":"error","filePath":"superset/dashboards/api.py","lineNumber":726,"sourceCode":"                          $ref: '#/components/schemas/DashboardDatasetSchema'\n            400:\n              $ref: '#/components/responses/400'\n            401:\n              $ref: '#/components/responses/401'\n            403:\n              $ref: '#/components/responses/403'\n            404:\n              $ref: '#/components/responses/404'\n        \"\"\"\n        try:\n            datasets = DashboardDAO.get_datasets_for_dashboard(id_or_slug)\n            result = [\n                self._serialize_dashboard_dataset(datasource, payload)\n                for datasource, payload in datasets\n            ]\n            return self.response(200, result=result)\n        except (TypeError, ValueError) as err:\n            raise DatasetValidationError(err) from err\n\n    def _serialize_dashboard_dataset(\n        self, datasource: Any, payload: dict[str, Any]\n    ) -> dict[str, Any]:\n        \"\"\"Dump a member dataset, narrowed when the caller cannot access it.\"\"\"\n        serialized = self.dashboard_dataset_schema.dump(payload)\n        if not security_manager.can_access_datasource(datasource):\n            for key in DASHBOARD_DATASET_INACCESSIBLE_FIELDS:\n                serialized.pop(key, None)\n        return serialized\n\n    def _serialize_dashboard_chart(self, chart: Any) -> dict[str, Any]:\n        \"\"\"Dump a member chart, narrowed when the caller cannot access it.\"\"\"\n        serialized = self.chart_entity_response_schema.dump(chart)\n        if not security_manager.can_access_chart(chart):\n            serialized.pop(\"form_data\", None)\n        return serialized\n","sourceCodeStart":708,"sourceCodeEnd":744,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/dashboards/api.py#L708-L744","documentation":"Thrown by the dashboard datasets endpoint (GET /api/v1/dashboard/<id_or_slug>/datasets) when DashboardDAO.get_datasets_for_dashboard raises TypeError or ValueError. It signals that the dashboard's dataset payloads could not be turned into serializable form — typically a malformed dashboard record or an unusable id/slug.","triggerScenarios":"Calling GET /api/v1/dashboard/{id_or_slug}/datasets with an id/slug whose stored dashboard metadata is malformed, or whose dataset payload objects cannot be paired with their datasources (e.g. dataset JSON columns corrupted or a payload that is not a dict).","commonSituations":"Dashboards imported from an older Superset version whose dataset payload structure differs; manual edits to the dashboards table; a slug colliding with a non-numeric string that DAO parsing rejects.","solutions":["Fetch the dashboard by the same id/slug via GET /api/v1/dashboard/<pk> to confirm the record itself loads and inspect its datasets.","Check the metadata DB positions/json metadata for the dashboard for corrupted or non-dict payload entries.","Re-save/re-migrate the dashboard (open it in the UI and save, or re-import a known-good export) to normalize its dataset payloads.","If it persists, reproduce with DashboardDAO.get_datasets_for_dashboard(id_or_slug) in a shell to see the raw TypeError/ValueError."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from superset.dashboards.api import DatasetValidationError\ntry:\n    resp = client.get(f\"/api/v1/dashboard/{slug}/datasets/\")\nexcept DatasetValidationError as err:\n    # inspect err.original exception for the underlying TypeError/ValueError\n    print(\"dashboard datasets unreadable:\", err)","preventionTips":["Confirm the dashboard loads normally in the UI before consuming the datasets endpoint.","Always import/export dashboards with the built-in flow so payload structures stay canonical.","Avoid hand-editing dashboard rows in the metadata database."],"tags":["dashboard","datasets","validation","api"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}