apache/superset · error · ChartNotFoundError
Chart not found.
Error message
Chart not found.
What it means
Raised as ChartNotFoundError by UnfavoriteChartCommand.validate() when ChartDAO.find_by_id finds no chart for the given id. The unfavorite operation is aborted; the id does not exist in the charts table (deleted, mistyped, or from another environment).
Source
Thrown at superset/commands/chart/unfave.py:49
logger = logging.getLogger(__name__)
class DelFavoriteChartCommand(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=ChartUnfaveError))
def run(self) -> None:
self.validate()
if self._chart:
return ChartDAO.remove_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
- Verify the chart id via GET /api/v1/chart/{id} before unfavoriting.
- Treat 404 as success — if the chart is gone, the favorite row is moot.
- Refresh favorites state in the client before issuing the call.
Example fix
# before
client.delete('/api/v1/chart/999/favorite/') # 404 ChartNotFoundError
# after
if client.get('/api/v1/chart/999').status_code == 200:
client.delete('/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:
UnfavoriteChartCommand(chart_id).run()
except ChartNotFoundError:
pass # chart gone; favorite is moot Prevention
- Treat unfavorite of a missing chart as a no-op.
- Refresh favorites state before acting on it.
When it happens
Trigger: DELETE /api/v1/chart/{id}/favorite/ with a stale or nonexistent chart id; unfavorite raced with a chart deletion in another session.
Common situations: UI list out of sync after the chart was removed; automated scripts reusing ids across environments.
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/de22a19b1dff3127.
Report an issue: GitHub.