apache/superset · error · WarmUpCacheChartNotFoundError

Chart not found

Error message

Chart not found

What it means

Raised as WarmUpCacheChartNotFoundError when the chart id passed to WarmUpCacheCommand does not resolve to a Slice row (db.session.query(Slice).filter_by(id=...).scalar() is None) and a Slice object was not supplied directly. Cache warm-up is aborted because there is no chart to warm.

Source

Thrown at superset/commands/chart/warm_up_cache.py:108

    def run(self) -> dict[str, Any]:
        self.validate()
        chart = cast(Slice, self._chart_or_id)

        try:
            error, status = self._warm_up_non_legacy_cache(chart)
        except Exception as ex:  # pylint: disable=broad-except
            error = error_msg_from_exception(ex)
            status = None

        return {"chart_id": chart.id, "viz_error": error, "viz_status": status}

    def validate(self) -> None:
        if isinstance(self._chart_or_id, Slice):
            chart = self._chart_or_id
        else:
            chart = db.session.query(Slice).filter_by(id=self._chart_or_id).scalar()
            if not chart:
                raise WarmUpCacheChartNotFoundError()
            self._chart_or_id = chart
        try:
            security_manager.raise_for_access(chart=chart)
        except SupersetSecurityException as ex:
            raise ChartAccessDeniedError() from ex

View on GitHub (pinned to f4587218dd)

Solutions

  1. Verify the chart exists with GET /api/v1/chart/{id} before requesting warm-up.
  2. Prune deleted chart ids from cache-warm-up schedules/config (CELERYBEAT_SCHEDULE or cache configuration).
  3. Handle 404 per-chart in bulk warm-up loops and continue.

Example fix

# before
client.post('/api/v1/chart/warm_up_cache', json={'chart_id': 999})  # 404

# after
if client.get('/api/v1/chart/999').status_code == 200:
    client.post('/api/v1/chart/warm_up_cache', json={'chart_id': 999})
Defensive patterns

Strategy: validation

Validate before calling

from superset.models.slice import Slice
from superset import db
if db.session.query(Slice).filter_by(id=chart_id).scalar() is None:
    raise ValueError(f'chart {chart_id} not found')

Try / catch

from superset.commands.chart.exceptions import WarmUpCacheChartNotFoundError
try:
    WarmUpCacheCommand(chart_id=chart_id).run()
except WarmUpCacheChartNotFoundError:
    prune_chart_from_warmup_schedule(chart_id)

Prevention

When it happens

Trigger: POST /api/v1/chart/warm_up_cache with a deleted, nonexistent, or mistyped chart id; warming from a config list (e.g. cache-warm-up celery task settings) that references charts removed from the database.

Common situations: Scheduled cache warm-up jobs listing stale chart ids after cleanup; environment drift between config files and the metadata DB.

Related errors


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