{"record":{"id":"1cfa2bc53ba80c9c","repo":"apache/superset","slug":"unsupported-chart-data-result-format-result-form","errorCode":null,"errorMessage":"Unsupported chart data result format: {result_format}","messagePattern":"Unsupported chart data result format: (.+?)","errorType":"exception","errorClass":"ReportScheduleExecuteUnexpectedError","httpStatus":500,"severity":"error","filePath":"superset/commands/report/execute.py","lineNumber":987,"sourceCode":"        with closing(\n            urllib.request.build_opener().open(request, timeout=timeout)  # noqa: S310\n        ) as response:\n            content = response.read()\n            if response.getcode() != 200:\n                raise URLError(response.getcode())\n        return content or None\n\n    def _get_data(self, result_format: ChartDataResultFormat) -> bytes:\n        \"\"\"\n        Fetch tabular chart data (CSV or Excel) as raw bytes.\n\n        Both formats are produced by the chart data export endpoint, so the\n        bytes are fetched the same way and only differ by ``result_format``.\n        This reuses the export path's post-processing and index handling,\n        keeping report output consistent with a chart's manual export.\n        \"\"\"\n        if result_format not in ChartDataResultFormat.table_like():\n            raise ReportScheduleExecuteUnexpectedError(\n                f\"Unsupported chart data result format: {result_format}\"\n            )\n\n        timeout_error: type[CommandException]\n        failed_error: type[CommandException]\n        if result_format == ChartDataResultFormat.XLSX:\n            label, timeout_error, failed_error = (\n                \"Excel\",\n                ReportScheduleXlsxTimeout,\n                ReportScheduleXlsxFailedError,\n            )\n        else:\n            label, timeout_error, failed_error = (\n                \"CSV\",\n                ReportScheduleCsvTimeout,\n                ReportScheduleCsvFailedError,\n            )\n","sourceCodeStart":969,"sourceCodeEnd":1005,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/report/execute.py#L969-L1005","documentation":"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.","triggerScenarios":"A report configuration or code path passing result_format=ChartDataResultFormat.JSON into _get_data; extensions/custom commands reusing _get_data with arbitrary formats.","commonSituations":"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.","solutions":["Set the report's delivery format to CSV or XLSX (the only table-like formats)","In custom code, branch before calling _get_data: JSON results must go through a different path, not the export fetch","Validate the format against ChartDataResultFormat.table_like() early and surface a config error to the user"],"exampleFix":"# before\nresult_format = ChartDataResultFormat.JSON\ndata = ctx._get_data(result_format)  # raises\n\n# after\nresult_format = ChartDataResultFormat.CSV\ndata = ctx._get_data(result_format)  # ok","handlingStrategy":"type-guard","validationCode":"from superset.common.chart_data import ChartDataResultFormat\n\nassert result_format in ChartDataResultFormat.table_like(), f'{result_format} not exportable as bytes'","typeGuard":"def is_table_like(fmt: ChartDataResultFormat) -> bool:\n    \"\"\"Only CSV/XLSX can be fetched as raw export bytes.\"\"\"\n    return fmt in ChartDataResultFormat.table_like()","tryCatchPattern":"try:\n    _get_data(result_format)\nexcept ReportScheduleExecuteUnexpectedError as ex:\n    if 'Unsupported chart data result format' in str(ex):\n        result_format = ChartDataResultFormat.CSV  # fall back to a supported format","preventionTips":["Restrict the report delivery-format picker to CSV/XLSX for data delivery","Branch on format before calling the byte-export path; JSON needs a different consumer","Check against ChartDataResultFormat.table_like() at the API boundary"],"tags":["alerts-reports","export","validation","charts"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}