{"record":{"id":"1ae34fb3c7a77b7b","repo":"apache/superset","slug":"error-loading-data-from-cache-1ae34f","errorCode":null,"errorMessage":"Error loading data from cache","messagePattern":"Error loading data from cache","errorType":"exception","errorClass":"CacheLoadError","httpStatus":404,"severity":"error","filePath":"superset/common/utils/query_cache_manager.py","lineNumber":236,"sourceCode":"                )\n                query_cache.bq_memory_limited_row_count = cache_value.get(\n                    \"bq_memory_limited_row_count\", 0\n                )\n                current_app.config[\"STATS_LOGGER\"].incr(\"loaded_from_cache\")\n            except KeyError as ex:\n                logger.exception(ex)\n                logger.error(\n                    \"Error reading cache: %s\",\n                    error_msg_from_exception(ex),\n                    exc_info=True,\n                )\n            logger.debug(\"Serving from cache\")\n\n        if force_cached and not query_cache.is_loaded:\n            logger.warning(\n                \"force_cached (QueryContext): value not found for key %s\", key\n            )\n            raise CacheLoadError(\"Error loading data from cache\")\n        return query_cache\n\n    @staticmethod\n    def set(\n        key: str | None,\n        value: dict[str, Any],\n        timeout: int | None = None,\n        datasource_uid: str | None = None,\n        region: CacheRegion = CacheRegion.DEFAULT,\n    ) -> None:\n        \"\"\"\n        set value to specify cache region, proxy for `set_and_log_cache`\n        \"\"\"\n        if key:\n            set_and_log_cache(_cache[region], key, value, timeout, datasource_uid)\n\n    @staticmethod\n    def delete(","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/common/utils/query_cache_manager.py#L218-L254","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"# before\nctx = QueryContext(...)\ndf = ctx.get_force_cached()  # raises CacheLoadError on cold cache\n\n# after\ntry:\n    df = ctx.get_force_cached()\nexcept CacheLoadError:\n    df = ctx.get_df()  # run query, which also repopulates the cache","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"from superset.exceptions import CacheLoadError\n\ntry:\n    result = query_context.get_force_cached()\nexcept CacheLoadError:\n    # cache cold: run the real query, which repopulates the cache\n    result = query_context.get_df()\n    if cache_enabled:\n        query_context.cache()","preventionTips":["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."],"tags":["cache","force-cached","alerts-reports","superset"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}