apache/superset · error

Export failed: ${response.status} ${response.statusText}

Error message

Export failed: ${response.status} ${response.statusText}

What it means

Thrown by the streaming export hook when the export fetch resolves with response.ok === false. The streaming-export path uses raw fetch (not SupersetClient), so non-2xx responses are not auto-unwrapped; the error records status and statusText (e.g. 'Export failed: 413 Payload Too Large') for diagnosis. The response body, which usually contains the real reason, is not read into the message.

Source

Thrown at superset-frontend/src/components/StreamingExportModal/useStreamingExport.ts:235

        filename,
      });

      try {
        const fetchOptions = await createFetchRequest(
          url,
          payload,
          filename,
          exportType,
          exportSource,
          expectedRows,
          abortControllerRef.current.signal,
        );
        // Guard: ensure URL has app root prefix for subdirectory deployments
        const prefixedUrl = ensureUrlPrefix(url);
        const response = await fetch(prefixedUrl, fetchOptions);

        if (!response.ok) {
          throw new Error(
            `Export failed: ${response.status} ${response.statusText}`,
          );
        }

        if (!response.body) {
          throw new Error('Response body is not available for streaming');
        }

        const contentDisposition = response.headers.get('Content-Disposition');
        const defaultFilename = `export.${exportType}`;
        let serverFilename = defaultFilename;

        if (contentDisposition) {
          const filenameMatch =
            contentDisposition.match(/filename="?([^"]+)"?/);
          if (filenameMatch && filenameMatch[1]) {
            serverFilename = filenameMatch[1];
          }

View on GitHub (pinned to f4587218dd)

Solutions

  1. Match the status: 401 re-login; 403 grant the user can_export on the datasource/dashboard; 413/504 reduce the export size or raise gateway/proxy timeouts and disable proxy buffering for the export route.
  2. Retry with a row limit / filtered export to confirm size is the trigger.
  3. Check Superset and proxy logs for the underlying server-side failure when status is 5xx.
Defensive patterns

Strategy: try-catch

Validate before calling

// No caller-side validation prevents a server 4xx/5xx; pre-check what you can:
if (!userCanExport) throw new Error('missing export permission');
if (estimatedRows > MAX_STREAM_ROWS) throw new Error('narrow the export');

Try / catch

try {
  await runStreamingExport(opts);
} catch (e) {
  const m = /Export failed: (\d+)/.exec(String(e?.message));
  if (m?.[1] === '401') await reLogin();
  else if (m?.[1] === '413' || m?.[1] === '504') suggestSmallerExport();
  else showExportError(e);
}

Prevention

When it happens

Trigger: Clicking a client- or server-side export that streams and the server rejecting it: 401 session expiry, 403 missing export permission (can_export etc.), 413 oversized query payload, 422 unsupported export args, or 500/504 when the export query fails or times out server-side.

Common situations: Large row-count exports hitting gateway body/time limits (nginx proxy_read_timeout, Gunicorn timeout); expired sessions on long-lived tabs; users lacking the CSV/dashboard export permission; reverse proxies buffering or rejecting streaming responses.

Related errors


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