apache/superset · error · ChartNotFoundError
Chart not found.
Error message
Chart not found.
What it means
ChartNotFoundError raised by ChartDAO.get_by_id_or_unicode(): the query by id-or-uuid (id_or_uuid_filter) additionally passes through ChartFilter (the DAO base/access filter), so 'not found' also covers 'exists but you can't see it'. one_or_none() returning None — either no row matches the id/uuid or the access filter removed it — triggers the error.
Source
Thrown at superset/daos/chart.py:126
if remaining_operators:
query = super().apply_column_operators(query, remaining_operators)
return query
@classmethod
def get_filterable_columns_and_operators(cls) -> Dict[str, List[str]]:
filterable = super().get_filterable_columns_and_operators()
# Add custom fields for charts
filterable.update(CHART_CUSTOM_FIELDS)
return filterable
@staticmethod
def get_by_id_or_uuid(id_or_uuid: str) -> Slice:
query = db.session.query(Slice).filter(id_or_uuid_filter(id_or_uuid))
# Apply chart base filters
query = ChartFilter("id", SQLAInterface(Slice, db.session)).apply(query, None)
chart = query.one_or_none()
if not chart:
raise ChartNotFoundError()
return chart
@staticmethod
def favorited_ids(charts: list[Slice]) -> list[FavStar]:
ids = [chart.id for chart in charts]
return [
star.obj_id
for star in db.session.query(FavStar.obj_id)
.filter(
FavStar.class_name == FavStarClassName.CHART,
FavStar.obj_id.in_(ids),
FavStar.user_id == get_user_id(),
)
.all()
]
@staticmethod
def add_favorite(chart: Slice) -> None:View on GitHub (pinned to f4587218dd)
Solutions
- Verify the chart exists and is visible to the acting user: list with GET /api/v1/chart/?q=(filter on id) as the same user.
- Use the chart's UUID (from the dashboard export or chart URL) rather than an integer id if ids may differ across environments.
- If permission is the cause, grant the user/role access (owner, roles, or all-users access on the chart).
- Remove the stale reference from the calling artifact.
Example fix
# before
chart = ChartDAO.get_by_id_or_uuid("abc123") # stale id from an old export
# after
import requests
resp = requests.get("/api/v1/chart/", params={"q": '{"filter": [{"col": "uuid", "opr": "eq", "value": "<uuid>"}]}'})
# resolve the live uuid first, then fetch it Defensive patterns
Strategy: try-catch
Validate before calling
def chart_exists_and_visible(id_or_uuid: str) -> bool:
try:
ChartDAO.get_by_id_or_uuid(id_or_uuid)
return True
except ChartNotFoundError:
return False Type guard
def looks_like_uuid(s: str) -> bool:
import uuid
try:
uuid.UUID(s)
return True
except (ValueError, AttributeError, TypeError):
return False Try / catch
try:
chart = ChartDAO.get_by_id_or_uuid(id_or_uuid)
except ChartNotFoundError:
abort(404) # covers both deleted and not-visible Prevention
- Reference charts by UUID in persistent integrations; ids are environment-specific.
- Verify visibility by listing as the acting user before deep-linking.
- Distinguish 404 (gone/invisible) from 403 in API handlers.
When it happens
Trigger: GET /api/v1/chart/<id-or-uuid> for a chart that was deleted, for an id/uuid that never existed, or for a chart the current user lacks permission to see (ChartFilter strips it). Malformed UUID in the id_or_uuid string also yields no match.
Common situations: Stale chart id/uuid in a bookmark, dashboard JSON, or API integration after the chart was deleted; a Gamma user requesting an admin-owned chart; copy/paste truncating the UUID.
Related errors
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/af1038cdb45469e8.
Report an issue: GitHub.