apache/superset · error · DatasetInvalidError
Dataset parameters are invalid.
Error message
Dataset parameters are invalid.
What it means
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.
Source
Thrown at superset/commands/dataset/duplicate.py:169
base_model.database,
Table(duplicate_name, base_model.schema, base_model.catalog),
):
exceptions.append(DatasetExistsValidationError(table=Table(duplicate_name)))
try:
from superset.commands.utils import populate_subject_list
editors = populate_subject_list(
self._properties.get("editors"),
default_to_user=True,
field_name="editors",
)
self._properties["editors"] = editors
except ValidationError as ex:
exceptions.append(ex)
if exceptions:
raise DatasetInvalidError(exceptions=exceptions)
View on GitHub (pinned to f4587218dd)
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.
Example fix
// before
POST /api/v1/dataset/duplicate
{"base_model_id": 7, "table_name": "sales_copy", "editors": [{"username": "ghost_user"}]}
// after
{"base_model_id": 7, "table_name": "sales_copy_2026_08", "editors": [{"username": "alice"}]} Defensive patterns
Strategy: validation
Validate before calling
# Pre-validate a duplicate request
from superset.daos.dataset import DatasetDAO
def duplicate_request_valid(base_model, new_name: str) -> list[str]:
problems = []
if base_model is None:
problems.append("base dataset not found")
elif base_model.kind != "virtual":
problems.append("only virtual datasets can be duplicated")
if base_model is not None and not DatasetDAO.validate_uniqueness(
base_model.database,
__import__("superset.connectors.sqla.models", fromlist=["Table"]).Table(
new_name, base_model.schema, base_model.catalog
),
):
problems.append("table_name already in use")
return problems Try / catch
from superset.commands.dataset.exceptions import DatasetInvalidError
try:
DuplicateDatasetCommand(base_id, properties).run()
except DatasetInvalidError as ex:
# inspect nested errors: kind, uniqueness, editors, base-missing each get their own UX
for err in ex.normalized_errors():
route_error_to_form(err["message"]) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Attempting to duplicate physical datasets expecting a copy of the table; name collisions like 'sales_copy' already taken; editors list containing removed users.
Related errors
- Dataset parameters are invalid.
- The database was not found.
- You don't have access to this dataset.
- Dataset column not found.
- Changing this dataset is forbidden.
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/a91570588cd6f5f5.
Report an issue: GitHub.