apache/superset · error · ReportScheduleExecuteUnexpectedError

Unsupported chart data result format: {result_format}

Error message

Unsupported chart data result format: {result_format}

What it means

ReportScheduleExecuteUnexpectedError('Unsupported chart data result format: {result_format}') from _get_data: only table-like formats (CSV and XLSX per ChartDataResultFormat.table_like()) may be fetched as raw export bytes. Any other ChartDataResultFormat (e.g. JSON) reaching this method is rejected because the export endpoint cannot produce it as tabular bytes.

Source

Thrown at superset/commands/report/execute.py:987

        with closing(
            urllib.request.build_opener().open(request, timeout=timeout)  # noqa: S310
        ) as response:
            content = response.read()
            if response.getcode() != 200:
                raise URLError(response.getcode())
        return content or None

    def _get_data(self, result_format: ChartDataResultFormat) -> bytes:
        """
        Fetch tabular chart data (CSV or Excel) as raw bytes.

        Both formats are produced by the chart data export endpoint, so the
        bytes are fetched the same way and only differ by ``result_format``.
        This reuses the export path's post-processing and index handling,
        keeping report output consistent with a chart's manual export.
        """
        if result_format not in ChartDataResultFormat.table_like():
            raise ReportScheduleExecuteUnexpectedError(
                f"Unsupported chart data result format: {result_format}"
            )

        timeout_error: type[CommandException]
        failed_error: type[CommandException]
        if result_format == ChartDataResultFormat.XLSX:
            label, timeout_error, failed_error = (
                "Excel",
                ReportScheduleXlsxTimeout,
                ReportScheduleXlsxFailedError,
            )
        else:
            label, timeout_error, failed_error = (
                "CSV",
                ReportScheduleCsvTimeout,
                ReportScheduleCsvFailedError,
            )

View on GitHub (pinned to f4587218dd)

Solutions

  1. Set the report's delivery format to CSV or XLSX (the only table-like formats)
  2. In custom code, branch before calling _get_data: JSON results must go through a different path, not the export fetch
  3. Validate the format against ChartDataResultFormat.table_like() early and surface a config error to the user

Example fix

# before
result_format = ChartDataResultFormat.JSON
data = ctx._get_data(result_format)  # raises

# after
result_format = ChartDataResultFormat.CSV
data = ctx._get_data(result_format)  # ok
Defensive patterns

Strategy: type-guard

Validate before calling

from superset.common.chart_data import ChartDataResultFormat

assert result_format in ChartDataResultFormat.table_like(), f'{result_format} not exportable as bytes'

Type guard

def is_table_like(fmt: ChartDataResultFormat) -> bool:
    """Only CSV/XLSX can be fetched as raw export bytes."""
    return fmt in ChartDataResultFormat.table_like()

Try / catch

try:
    _get_data(result_format)
except ReportScheduleExecuteUnexpectedError as ex:
    if 'Unsupported chart data result format' in str(ex):
        result_format = ChartDataResultFormat.CSV  # fall back to a supported format

Prevention

When it happens

Trigger: A report configuration or code path passing result_format=ChartDataResultFormat.JSON into _get_data; extensions/custom commands reusing _get_data with arbitrary formats.

Common situations: Custom delivery code forwarding a user-chosen format straight to the data fetch; config drift where a report's delivery_format ends up as json.

Related errors


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