apache/superset · error · ChartDataCacheLoadError

Error loading data from cache

Error message

Error loading data from cache

What it means

ChartDataCacheLoadError (CommandException) raised in ChartDataCommand.run() (get_data_command.py:51) when query_context.get_payload() signals CacheLoadError — the stored async-query payload for the computed cache key could not be loaded. The underlying message (e.g. 'Cached data not found') is passed through and the original exception chained. Typical of force_cached=True requests hitting an expired/evicted entry.

Source

Thrown at superset/commands/chart/data/get_data_command.py:51


class ChartDataCommand(BaseCommand):
    _query_context: QueryContext

    def __init__(self, query_context: QueryContext):
        self._query_context = query_context

    def run(self, **kwargs: Any) -> dict[str, Any]:
        # caching is handled in query_context.get_df_payload
        # (also evals `force` property)
        cache_query_context = kwargs.get("cache", False)
        force_cached = kwargs.get("force_cached", False)
        try:
            payload = self._query_context.get_payload(
                cache_query_context=cache_query_context, force_cached=force_cached
            )
        except CacheLoadError as ex:
            raise ChartDataCacheLoadError(ex.message) from ex

        # Skip error check for query-only requests - errors are returned in payload
        # This allows View Query modal to display validation errors
        for query in payload["queries"]:
            if (
                query.get("error")
                and self._query_context.result_type != ChartDataResultType.QUERY
            ):
                raise ChartDataQueryFailedError(
                    _("Error: %(error)s", error=query["error"])
                )

        return_value = {
            "query_context": self._query_context,
            "queries": payload["queries"],
        }
        if cache_query_context:
            return_value.update(cache_key=payload["cache_key"])

View on GitHub (pinned to f4587218dd)

Solutions

  1. Retry the request without force_cached (or with force: true) to recompute and refresh the cache.
  2. Increase the cache TTL / capacity for the chart-data cache config so entries survive until read.
  3. Point all nodes at one shared Redis and keep Superset versions aligned so keys match.

Example fix

# before
payload = ChartDataCommand(qc).run(cache=True, force_cached=True)

# after
try:
    payload = ChartDataCommand(qc).run(cache=True, force_cached=True)
except ChartDataCacheLoadError:
    payload = ChartDataCommand(qc).run(cache=True)  # recompute fresh
Defensive patterns

Strategy: fallback

Validate before calling

from superset import cache

def can_load_cached(cache_key: str) -> bool:
    return bool(cache.get(cache_key))

if force_cached and not can_load_cached(cache_key):
    force_cached = False  # recompute instead of failing

Try / catch

try:
    payload = ChartDataCommand(qc).run(cache=use_cache, force_cached=True)
except ChartDataCacheLoadError:
    payload = ChartDataCommand(qc).run(cache=use_cache)  # fresh recompute

Prevention

When it happens

Trigger: POST /api/v1/chart/data with force_cached=true after the cached result TTL'd out or Redis evicted it; async query result pickup where the cache key was written by a node with different config; cache backend flushed between query and fetch.

Common situations: Long-running dashboards with short cache TTLs; rolling upgrades changing cache-key derivation; multi-node setups without a shared cache; Redis maxmemory eviction under load.

Related errors


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