apache/superset · error · ChartInvalidError

Chart parameters are invalid.

Error message

Chart parameters are invalid.

What it means

Raised as ChartInvalidError(exceptions=[...]) at the end of UpdateChartCommand.validate() when one or more non-fatal validation errors accumulated: dashboard ids that do not resolve (DashboardsNotFoundValidationError), a missing datasource_type when datasource_id is given, invalid tags, or subject-computation errors. The exception carries the list of specific ValidationErrors to inspect.

Source

Thrown at superset/commands/chart/update.py:230

            except ValidationError as ex:
                exceptions.append(ex)

        # Validate/Populate dashboards only if it's a list
        if dashboard_ids is not None:
            # First, verify all requested dashboards exist
            dashboards = DashboardDAO.find_by_ids(
                dashboard_ids,
                skip_base_filter=True,
            )
            if len(dashboards) != len(dashboard_ids):
                exceptions.append(DashboardsNotFoundValidationError())
            else:
                # Then, validate user has access to any NEW dashboard relationships
                self._validate_new_dashboard_access(dashboards, exceptions)
            self._properties["dashboards"] = dashboards

        if exceptions:
            raise ChartInvalidError(exceptions=exceptions)

View on GitHub (pinned to f4587218dd)

Solutions

  1. Read the nested exceptions list in the error payload — it names exactly which validations failed.
  2. Fix each item: verify dashboard ids via GET /api/v1/dashboard/, include datasource_type whenever datasource_id is sent, drop invalid tag ids.
  3. Retry the update with only resolvable references.

Example fix

# before
client.put('/api/v1/chart/42', json={'datasource_id': 7})  # ChartInvalidError

# after: always pair id with type
client.put('/api/v1/chart/42', json={'datasource_id': 7, 'datasource_type': 'table'})
Defensive patterns

Strategy: validation

Validate before calling

if 'datasource_id' in props and not props.get('datasource_type'):
    raise ValueError('datasource_type required with datasource_id')
if 'dashboards' in props:
    found = DashboardDAO.find_by_ids(props['dashboards'], skip_base_filter=True)
    if len(found) != len(props['dashboards']):
        raise ValueError('some dashboard ids do not exist')

Try / catch

from superset.commands.chart.exceptions import ChartInvalidError
try:
    UpdateChartCommand(chart_id, props).run()
except ChartInvalidError as ex:
    for ve in ex.exceptions:
        logger.error('validation failed: %r', ve)  # fix each and retry

Prevention

When it happens

Trigger: PUT /api/v1/chart/{id} with dashboards=[...] containing nonexistent dashboard ids; providing datasource_id without datasource_type; tag_ids referencing tags that fail validate_tags.

Common situations: Stale dashboard ids after cleanup; partial payloads copied between environments; tag references to deleted tags.

Related errors


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