{"record":{"id":"56e687ad1de01698","repo":"apache/superset","slug":"dataset-parameters-are-invalid-56e687","errorCode":null,"errorMessage":"Dataset parameters are invalid.","messagePattern":"Dataset parameters are invalid\\.","errorType":"exception","errorClass":"DatasetInvalidError","httpStatus":422,"severity":"error","filePath":"superset/commands/dataset/update.py","lineNumber":120,"sourceCode":"        # Validate/populate model exists\n        self._model = DatasetDAO.find_by_id(self._model_id)\n        if not self._model:\n            raise DatasetNotFoundError()\n\n        # Check permission to update the dataset\n        try:\n            security_manager.raise_for_editorship(self._model)\n        except SupersetSecurityException as ex:\n            raise DatasetForbiddenError() from ex\n\n        # Validate/Populate editors\n        compute_subjects(self._model, self._properties, exceptions)\n\n        self._validate_dataset_source(exceptions)\n        self._validate_semantics(exceptions)\n\n        if exceptions:\n            raise DatasetInvalidError(exceptions=exceptions)\n\n    def _validate_dataset_source(self, exceptions: list[ValidationError]) -> None:\n        # we know we have a valid model\n        self._model = cast(SqlaTable, self._model)\n        database_id = self._properties.pop(\"database_id\", None)\n        new_db_connection = self._get_new_database_connection(database_id, exceptions)\n        db = new_db_connection or self._model.database\n        database_changed = new_db_connection is not None\n\n        # Detect a caller-supplied change to the source binding, inspected\n        # before the catalog normalization below injects derived values.\n        source_changed = database_changed or any(\n            field in self._properties\n            and self._properties[field] != getattr(self._model, field)\n            for field in (\"catalog\", \"schema\", \"table_name\")\n        )\n\n        catalog, schema, table = self._resolve_catalog_schema_table(db, exceptions)","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/dataset/update.py#L102-L138","documentation":"DatasetInvalidError aggregates ValidationError objects collected during UpdateDatasetCommand.validate() — from compute_subjects (owners), _validate_dataset_source (database binding / physical table checks), and _validate_semantics. The response body carries the per-field exception list, so inspect it to see which property failed.","triggerScenarios":"PUT /api/v1/dataset/{id} with an invalid owners array (unknown user), changing database_id to one that doesn't contain the table, invalid semantic overrides (bad metric/column definitions), or malformed values that pass marshmallow but fail business validation.","commonSituations":"Changing a dataset's database_id after the target database was renamed/removed. Referencing owner usernames that no longer exist (LDAP sync removed them). Copy-pasting dataset YAML between instances where referenced databases differ.","solutions":["Read the 'exceptions' array in the 422 response — each entry names the offending field and reason; fix those properties.","For owner errors, resolve usernames/ids first (GET /api/v1/users) and resend the owners list.","For source errors, confirm the target database exists (GET /api/v1/database) and that the table/schema/catalog are reachable and correctly cased.","For semantics errors, validate metric/column expressions in SQL Lab before submitting."],"exampleFix":"# before\nclient.put(\"/api/v1/dataset/42\", json={\"owners\": [\"ghost_user\"], \"database_id\": 99})\n# 422 Dataset parameters are invalid.\n\n# after\nowners = [u[\"id\"] for u in client.get(\"/api/v1/users?q=(username:eq:alice)\").json()[\"result\"]]\nclient.put(\"/api/v1/dataset/42\", json={\"owners\": owners})","handlingStrategy":"try-catch","validationCode":"owners_ok = all(user_exists(o) for o in properties.get(\"owners\", []))\ndb_ok = \"database_id\" not in properties or database_exists(properties[\"database_id\"])\nassert owners_ok and db_ok, \"fix referenced ids before submit\"","typeGuard":null,"tryCatchPattern":"try:\n    UpdateDatasetCommand(user, model_id, properties).run()\nexcept DatasetInvalidError as ex:\n    for ve in ex.exceptions:\n        field, msg = ve.normalized_messages()  # act per-field\n        report(f\"{field}: {msg}\")","preventionTips":["Resolve owner ids against /api/v1/users before sending.","Verify database_id and table presence before rebinding a dataset.","Validate metric SQL in SQL Lab before embedding in dataset payloads."],"tags":["dataset","validation","api","crud"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}