apache/superset · error · Error

Failed to load chart data

Error message

Failed to load chart data

What it means

The standalone chart page bootstrap: when the page is loaded without server-rendered bootstrap data, it fetches the chart via getChartDataAndParams; on failure it throws 'Failed to load chart data' (appending the backend's message when present). This is the top-level 'the chart could not be loaded at all' error for direct chart/permmalink navigation.

Source

Thrown at superset-frontend/src/pages/Chart/index.tsx:88

      return rv;
    }
    // Since there's no dataset id but the API responded with a valid payload,
    // we assume the dataset was deleted, so we preserve some values from previous
    // state so if the user decide to swap the datasource, the chart config remains
    fallbackExploreInitialData.form_data = {
      ...rv.result.form_data,
      ...fallbackExploreInitialData.form_data,
    };
    if (rv.result?.slice) {
      fallbackExploreInitialData.slice = rv.result.slice;
    }
  }
  let message = t('Failed to load chart data');
  const responseError = rv?.result?.message;
  if (responseError) {
    message = `${message}:\n${responseError}`;
  }
  throw new Error(message);
};

const getDashboardPageContext = (pageId?: string | null) => {
  if (!pageId) {
    return null;
  }
  return getItem(LocalStorageKeys.DashboardExploreContext, {})[pageId] || null;
};

const getDashboardContextFormData = (search: string) => {
  const dashboardPageId = getUrlParam(URL_PARAMS.dashboardPageId, search);
  const dashboardContext = getDashboardPageContext(dashboardPageId);
  if (dashboardContext) {
    const sliceId = getUrlParam(URL_PARAMS.sliceId, search) || 0;
    const {
      colorScheme,
      labelsColor,
      labelsColorMap,

View on GitHub (pinned to f4587218dd)

Solutions

  1. Confirm the chart id exists and the current user can view it (GET /api/v1/chart/{id}).
  2. Check the appended backend message — it usually carries the root cause (e.g. dataset error).
  3. Review the backend log for the failing /chart/data or chart GET request.
  4. Re-login if the session expired, then reload the page.
Defensive patterns

Strategy: fallback

Validate before calling

import SupersetClient from '@superset-ui/core';

async function chartIsReadable(chartId: number): Promise<boolean> {
  try {
    const r = await SupersetClient.get({ endpoint: `/api/v1/chart/${chartId}` });
    return r.status === 200;
  } catch {
    return false;
  }
}

Type guard

function hasBackendMessage(rv: unknown): rv is { result: { message?: string } } {
  return !!rv && typeof rv === 'object' && !!(rv as { result?: unknown }).result;
}

Try / catch

// keep a cached/permalink fallback and show the backend message verbatim
try {
  bootstrapData = await getChartDataAndParams(chartId);
} catch (e) {
  showErrorPage((e as Error).message); // 'Failed to load chart data: <backend msg>'
}

Prevention

When it happens

Trigger: Navigating directly to /chart/{id} (or a permalink) when the fetch of chart data fails: chart id nonexistent, no permission (403/404), backend 500, or the async data message contains an error; also when result and message are both absent.

Common situations: User opens a chart link they cannot access; chart deleted; backend exception in chart load; network/proxy failure; session expired mid-navigation.

Related errors


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