apache/superset · error · ValueError
Chart %(chart_id)s is not on dashboard %(dashboard_id)s
Error message
Chart %(chart_id)s is not on dashboard %(dashboard_id)s
What it means
ValueError raised by _validate_chart_on_dashboard in the dashboard filter context pipeline (used by chart data requests that apply dashboard-level filters): it collects the slice ids attached to the dashboard and raises when the requested chart_id is not among them. A chart must be part of the dashboard for its data request to be evaluated in that dashboard's filter context.
Source
Thrown at superset/charts/data/dashboard_filter_context.py:249
if isinstance(column, dict):
return column.get("name")
if isinstance(column, str):
return column
return None
def _validate_chart_on_dashboard(
dashboard: Dashboard,
chart_id: int,
) -> None:
"""
Validate that a chart belongs to a dashboard.
:raises ValueError: if the chart is not found on the dashboard
"""
slice_ids = {slc.id for slc in dashboard.slices}
if chart_id not in slice_ids:
raise ValueError(
_(
"Chart %(chart_id)s is not on dashboard %(dashboard_id)s",
chart_id=chart_id,
dashboard_id=dashboard.id,
)
)
def _check_dashboard_access(dashboard: Dashboard) -> None:
"""
Check that the user has access to the dashboard.
Uses the security manager's raise_for_access which handles
guest users, admins, editors, and viewer access.
:raises SupersetSecurityException: if the user cannot access the dashboard
"""
security_manager.raise_for_access(dashboard=dashboard)
View on GitHub (pinned to f4587218dd)
Solutions
- Refresh the dashboard in the browser so form_data is re-synced with the current dashboard layout.
- If you maintain the payload, verify chart_id is actually in dashboard.slices (e.g. GET the dashboard and check its chart ids) before requesting data with that dashboard context.
- For imports, re-map chart ids consistently so dashboard layout and filter metadata reference charts that exist on the imported dashboard.
- Remove/re-add the chart to the dashboard if the layout JSON is out of sync with the slice relationship.
Example fix
# before
payload = {"form_data": {"slice_id": 42, "dashboard_id": 7}} # chart 42 not on dashboard 7
resp = requests.post("/api/v1/chart/data", json=payload)
# after: confirm membership first
dash = requests.get("/api/v1/dashboard/7", headers=auth).json()["result"]
chart_ids = {c["slice_id"] for c in dash["position_slices"]} # or dash['slices']
assert 42 in chart_ids, "chart not on dashboard; refresh or fix dashboard layout" Defensive patterns
Strategy: validation
Validate before calling
slice_ids = {slc.id for slc in dashboard.slices}
if chart_id not in slice_ids:
raise ValueError(
f"chart {chart_id} not on dashboard {dashboard.id}; refresh or fix dashboard layout"
) Try / catch
try:
ctx = build_dashboard_filter_context(dashboard, chart_id, form_data)
except ValueError as ex:
if "is not on dashboard" in str(ex):
# stale client state: refetch dashboard metadata and re-sync form_data
refetch_and_retry() Prevention
- After editing a dashboard (removing charts), reload dependent tabs before issuing chart-data requests with dashboard context.
- On import/export, re-map chart ids consistently across layout, native filters, and chart metadata.
When it happens
Trigger: Requesting chart data with a dashboard_id and a chart_id for a chart that was removed from that dashboard, belongs to a different dashboard, or whose layout entry was deleted while stale form_data still references the old pairing; also chart/dashboard id mix-ups after imports re-assign ids.
Common situations: Stale browser state: a dashboard tab open from before an edit removed the chart, and the client re-issues the chart's data request with nativeFilters/dashboard context; cross-dashboard copied charts where the old dashboard_id lingers in form_data; import/export flows where native filter or layout metadata references chart ids not present on the target dashboard.
Related errors
- Not a ZIP file
- No valid import files were found
- Request is incorrect
- Unsupported whisker type: ${whiskerOptions}
- Found invalid orderby options
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/bd6bc2b952698080.
Report an issue: GitHub.