apache/superset · error · DashboardInvalidError

Dashboard parameters are invalid.

Error message

Dashboard parameters are invalid.

What it means

DashboardInvalidError from CreateDashboardCommand.validate() aggregates validation failures: a slug that already exists on another dashboard (DashboardSlugExistsValidationError) or invalid owners/roles produced by populate_subjects. The exception carries the list of per-field errors in its 'exceptions' attribute, which the API serializes into a 422 response.

Source

Thrown at superset/commands/dashboard/create.py:76

        return dashboard

    def validate(self) -> None:
        exceptions: list[ValidationError] = []
        # An absent slug must stay ``None`` (not default to ``""``):
        # ``validate_slug_uniqueness`` deliberately checks empty strings, so
        # coercing absent → "" would run the check as ``slug == ""`` and 422
        # every slugless create once any empty-string-slug row exists. This
        # mirrors the update path, which also passes ``None`` through.
        slug: str | None = self._properties.get("slug")

        # Validate slug uniqueness
        if not DashboardDAO.validate_slug_uniqueness(slug):
            exceptions.append(DashboardSlugExistsValidationError())

        populate_subjects(self._properties, exceptions)

        if exceptions:
            raise DashboardInvalidError(exceptions=exceptions)

View on GitHub (pinned to f4587218dd)

Solutions

  1. Inspect the 422 response body: each item in exceptions names the exact failing field (slug vs owners/roles).
  2. If the slug is taken, choose a different slug or omit it and let Superset generate one; or delete/rename the conflicting dashboard first.
  3. For owner failures, verify the owner ids/usernames exist in this environment and that the caller may assign them.
  4. Use DashboardDAO.validate_slug_uniqueness(slug) before creating.

Example fix

# before
CreateDashboardCommand({'dashboard_title': 'Ops', 'slug': 'ops'}).run()  # 'ops' taken

# after
from superset.daos.dashboard import DashboardDAO
slug = 'ops'
if not DashboardDAO.validate_slug_uniqueness(slug):
    slug = f'ops-{uuid4().hex[:6]}'
CreateDashboardCommand({'dashboard_title': 'Ops', 'slug': slug}).run()
Defensive patterns

Strategy: validation

Validate before calling

from superset.daos.dashboard import DashboardDAO

slug = props.get('slug')
if slug and not DashboardDAO.validate_slug_uniqueness(slug):
    props['slug'] = f"{slug}-{uuid4().hex[:6]}"  # or surface a 409 to the user

Try / catch

try:
    CreateDashboardCommand(props).run()
except DashboardInvalidError as ex:
    for sub in ex.exceptions:
        # each sub names the field: slug / owners / roles
        field_errors[sub.field_name] = str(sub)

Prevention

When it happens

Trigger: POST /api/v1/dashboard/ with a 'slug' matching an existing dashboard's slug; or with owners/roles entries (ids or usernames) that fail the subject-population checks (unknown user, no permission to assign that owner).

Common situations: Scripts creating dashboards with fixed slugs that collide after re-running; migrating dashboards between environments where the slug is already taken; passing an owner id from a different environment's user table.

Related errors


AI-assisted analysis of apache/superset@f4587218dd (2026-08-14). Data as JSON: /api/errors/8e9c349c167a41e7. Report an issue: GitHub.