{"record":{"id":"a91570588cd6f5f5","repo":"apache/superset","slug":"dataset-parameters-are-invalid-a91570","errorCode":null,"errorMessage":"Dataset parameters are invalid.","messagePattern":"Dataset parameters are invalid\\.","errorType":"validation","errorClass":"DatasetInvalidError","httpStatus":422,"severity":"error","filePath":"superset/commands/dataset/duplicate.py","lineNumber":169,"sourceCode":"            base_model.database,\n            Table(duplicate_name, base_model.schema, base_model.catalog),\n        ):\n            exceptions.append(DatasetExistsValidationError(table=Table(duplicate_name)))\n\n        try:\n            from superset.commands.utils import populate_subject_list\n\n            editors = populate_subject_list(\n                self._properties.get(\"editors\"),\n                default_to_user=True,\n                field_name=\"editors\",\n            )\n            self._properties[\"editors\"] = editors\n        except ValidationError as ex:\n            exceptions.append(ex)\n\n        if exceptions:\n            raise DatasetInvalidError(exceptions=exceptions)\n","sourceCodeStart":151,"sourceCodeEnd":170,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/dataset/duplicate.py#L151-L170","documentation":"DatasetInvalidError (HTTP 422, 'Dataset parameters are invalid.') from the duplicate command aggregates validation failures: base_model_id not found (DatasetNotFoundError appended), base dataset kind != 'virtual' (DatasourceTypeInvalidError — only virtual datasets can be duplicated), a duplicate table_name failing the shared uniqueness check, and editors populated via populate_subject_list failing validation. The response's nested errors list identifies which.","triggerScenarios":"POST /api/v1/dataset/duplicate targeting a physical (non-virtual) dataset; choosing a table_name already used by another dataset on the same database/schema/catalog (including a soft-deleted twin); passing editors entries that don't resolve; passing a nonexistent base_model_id.","commonSituations":"Attempting to duplicate physical datasets expecting a copy of the table; name collisions like 'sales_copy' already taken; editors list containing removed users.","solutions":["Read the nested errors array: it distinguishes base-model-missing, wrong kind, name collision, and editors problems.","Only duplicate virtual datasets (kind == 'virtual'); to copy a physical dataset, create a new dataset over the table instead.","Pick a unique table_name scoped to the base dataset's database/catalog/schema; if the message chain mentions a soft-deleted twin, restore or rename.","Send editors as a list of existing usernames/roles, or omit the key to default to the caller."],"exampleFix":"// before\nPOST /api/v1/dataset/duplicate\n{\"base_model_id\": 7, \"table_name\": \"sales_copy\", \"editors\": [{\"username\": \"ghost_user\"}]}\n\n// after\n{\"base_model_id\": 7, \"table_name\": \"sales_copy_2026_08\", \"editors\": [{\"username\": \"alice\"}]}","handlingStrategy":"validation","validationCode":"# Pre-validate a duplicate request\nfrom superset.daos.dataset import DatasetDAO\n\ndef duplicate_request_valid(base_model, new_name: str) -> list[str]:\n    problems = []\n    if base_model is None:\n        problems.append(\"base dataset not found\")\n    elif base_model.kind != \"virtual\":\n        problems.append(\"only virtual datasets can be duplicated\")\n    if base_model is not None and not DatasetDAO.validate_uniqueness(\n        base_model.database,\n        __import__(\"superset.connectors.sqla.models\", fromlist=[\"Table\"]).Table(\n            new_name, base_model.schema, base_model.catalog\n        ),\n    ):\n        problems.append(\"table_name already in use\")\n    return problems","typeGuard":null,"tryCatchPattern":"from superset.commands.dataset.exceptions import DatasetInvalidError\ntry:\n    DuplicateDatasetCommand(base_id, properties).run()\nexcept DatasetInvalidError as ex:\n    # inspect nested errors: kind, uniqueness, editors, base-missing each get their own UX\n    for err in ex.normalized_errors():\n        route_error_to_form(err[\"message\"])","preventionTips":["Only offer Duplicate on virtual datasets; for physical ones, guide users to create a new dataset over the table.","Generate the copy's table_name with a suffix/uuid to dodge uniqueness collisions.","Pass editors as existing usernames/roles or omit the key entirely."],"tags":["dataset","duplicate","validation","flask-api"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}