apache/superset · error · CacheLoadError
Error loading data from cache
Error message
Error loading data from cache
What it means
CacheLoadError("Error loading data from cache") raised in QueryCacheManager.get (query_cache_manager.py:236) when force_cached is true but the cache entry for the computed key was not found or could not be loaded. force_cached tells Superset to serve results exclusively from cache (used by alerts/reports rendering); when nothing is cached under that key, Superset refuses to fall back to running the query and raises.
Source
Thrown at superset/common/utils/query_cache_manager.py:236
)
query_cache.bq_memory_limited_row_count = cache_value.get(
"bq_memory_limited_row_count", 0
)
current_app.config["STATS_LOGGER"].incr("loaded_from_cache")
except KeyError as ex:
logger.exception(ex)
logger.error(
"Error reading cache: %s",
error_msg_from_exception(ex),
exc_info=True,
)
logger.debug("Serving from cache")
if force_cached and not query_cache.is_loaded:
logger.warning(
"force_cached (QueryContext): value not found for key %s", key
)
raise CacheLoadError("Error loading data from cache")
return query_cache
@staticmethod
def set(
key: str | None,
value: dict[str, Any],
timeout: int | None = None,
datasource_uid: str | None = None,
region: CacheRegion = CacheRegion.DEFAULT,
) -> None:
"""
set value to specify cache region, proxy for `set_and_log_cache`
"""
if key:
set_and_log_cache(_cache[region], key, value, timeout, datasource_uid)
@staticmethod
def delete(View on GitHub (pinned to f4587218dd)
Solutions
- Ensure a normal (non-forced) query runs at least once to populate the cache before requesting force_cached results; pre-warm on a schedule with TTL longer than the report interval.
- Increase CACHE_CONFIG / DATA_CACHE_CONFIG TIMEOUT so entries outlive the report cadence.
- Verify the cache backend is reachable and shared (Redis URL) across all Superset nodes (web workers, Celery beat/workers).
- If the error is acceptable in your flow, catch CacheLoadError and re-issue the query without force_cached.
Example fix
# before
ctx = QueryContext(...)
df = ctx.get_force_cached() # raises CacheLoadError on cold cache
# after
try:
df = ctx.get_force_cached()
except CacheLoadError:
df = ctx.get_df() # run query, which also repopulates the cache Defensive patterns
Strategy: retry
Try / catch
from superset.exceptions import CacheLoadError
try:
result = query_context.get_force_cached()
except CacheLoadError:
# cache cold: run the real query, which repopulates the cache
result = query_context.get_df()
if cache_enabled:
query_context.cache() Prevention
- Pre-warm report queries on a schedule with interval < cache TTL.
- Use a shared Redis cache across web and Celery workers so all nodes see the same keys.
- Monitor cache hit rates for alert/report cache keys and alert before TTL-induced misses.
When it happens
Trigger: Calling QueryContext.get_force_cached() (or an alert/report executor with force=true) for a query whose cache key has expired, was evicted, or was never populated (e.g. cache disabled, first run, changed cache key due to a different datasource/schema hash).
Common situations: Alerts & Reports with the force cached flag hitting after cache TTL expiry; Redis/memory cache restarts wiping keys; CONFIG_PATH_CACHE or cache key ingredients changing across versions; local dev with cache off while testing reports.
Related errors
- validation_error
- security_error
- Error loading data from cache
- Unsupported whisker type: ${whiskerOptions}
- Found invalid orderby options
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/1ae34fb3c7a77b7b.
Report an issue: GitHub.