apache/superset · error · ChartNotFoundError
Chart not found.
Error message
Chart not found.
What it means
Raised as ChartNotFoundError by FavoriteChartCommand.validate() when ChartDAO.find_by_id returns nothing for the given chart id. Favoriting is aborted before any favorite row is written; the id simply does not exist in the charts table.
Source
Thrown at superset/commands/chart/fave.py:49
logger = logging.getLogger(__name__)
class AddFavoriteChartCommand(BaseCommand):
def __init__(self, chart_id: int) -> None:
self._chart_id = chart_id
self._chart: Slice | None = None
@transaction(on_error=partial(on_error, reraise=ChartFaveError))
def run(self) -> None:
self.validate()
if self._chart:
return ChartDAO.add_favorite(self._chart)
def validate(self) -> None:
chart = ChartDAO.find_by_id(self._chart_id)
if not chart:
raise ChartNotFoundError()
try:
security_manager.raise_for_access(chart=chart)
except SupersetSecurityException as ex:
raise ChartAccessDeniedError() from ex
self._chart = chart
View on GitHub (pinned to f4587218dd)
Solutions
- Confirm the chart exists via GET /api/v1/chart/{id} before favoriting.
- Refresh the chart list in the UI and favorite from the current id.
- Handle 404 as a no-op if the favorite is best-effort.
Example fix
# before
client.post('/api/v1/chart/999/favorite/') # 404 ChartNotFoundError
# after
resp = client.get('/api/v1/chart/999')
if resp.status_code == 200:
client.post('/api/v1/chart/999/favorite/') Defensive patterns
Strategy: validation
Validate before calling
if not ChartDAO.find_by_id(chart_id):
raise ValueError(f'chart {chart_id} does not exist') Try / catch
from superset.commands.chart.exceptions import ChartNotFoundError
try:
FavoriteChartCommand(chart_id).run()
except ChartNotFoundError:
refresh_chart_list() # stale id in UI Prevention
- Favorite only from freshly loaded chart lists.
- Check chart existence before API calls in integrations.
When it happens
Trigger: POST /api/v1/chart/{id}/favorite/ with a nonexistent, already-deleted, or mistyped chart id; favoriting from a stale front-end list after the chart was removed elsewhere.
Common situations: Deep-linked favorites button on an expired chart id; scripts referencing ids from another environment.
Related errors
- Chart not found.
- Chart not found.
- Chart not found.
- Chart not found.
- Dashboard %(dashboard_id)s not found
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/ffbd3d18f6476feb.
Report an issue: GitHub.