apache/superset · critical · Exception

Cache backends (CACHE_CONFIG, DATA_CACHE_CONFIG) must be con

Error message

Cache backends (CACHE_CONFIG, DATA_CACHE_CONFIG) must be configured and non-null in order to enable async queries

What it means

AsyncQueryManager.init_app() raises a plain Exception at startup when either CACHE_CONFIG.CACHE_TYPE or DATA_CACHE_CONFIG.CACHE_TYPE is None or 'null'. Global async queries offload chart data requests to Celery and store results in the data cache, so both cache backends must be real (non-null) before the feature can be enabled — a deliberate fail-fast guard during app initialization.

Source

Thrown at superset/async_events/async_query_manager.py:133

        super().__init__()
        self._cache: Optional[BaseCache] = None
        self._stream_prefix: str = ""
        self._stream_limit: Optional[int]
        self._stream_limit_firehose: Optional[int]
        self._jwt_cookie_name: str = ""
        self._jwt_cookie_secure: bool = False
        self._jwt_cookie_domain: Optional[str]
        self._jwt_cookie_samesite: Optional[Literal["None", "Lax", "Strict"]] = None
        self._jwt_secret: str
        self._jwt_expiration_seconds: int = 0
        self._load_chart_data_into_cache_job: Any = None
        # pylint: disable=invalid-name

    def init_app(self, app: Flask) -> None:
        cache_type = app.config.get("CACHE_CONFIG", {}).get("CACHE_TYPE")
        data_cache_type = app.config.get("DATA_CACHE_CONFIG", {}).get("CACHE_TYPE")
        if cache_type in [None, "null"] or data_cache_type in [None, "null"]:
            raise Exception(  # pylint: disable=broad-exception-raised
                """
                Cache backends (CACHE_CONFIG, DATA_CACHE_CONFIG) must be configured
                and non-null in order to enable async queries
                """
            )

        self._cache = get_cache_backend(app.config)
        logger.debug("Using GAQ Cache backend as %s", type(self._cache).__name__)

        if len(app.config["GLOBAL_ASYNC_QUERIES_JWT_SECRET"]) < 32:
            raise AsyncQueryTokenException(
                "Please provide a JWT secret at least 32 bytes long"
            )

        self._stream_prefix = app.config["GLOBAL_ASYNC_QUERIES_REDIS_STREAM_PREFIX"]
        self._stream_limit = app.config["GLOBAL_ASYNC_QUERIES_REDIS_STREAM_LIMIT"]
        self._stream_limit_firehose = app.config[
            "GLOBAL_ASYNC_QUERIES_REDIS_STREAM_LIMIT_FIREHOSE"

View on GitHub (pinned to f4587218dd)

Solutions

  1. Configure both caches in superset_config.py, e.g. CACHE_CONFIG = {"CACHE_TYPE": "RedisCache", "CACHE_URL": ...} and DATA_CACHE_CONFIG likewise.
  2. Or disable GLOBAL_ASYNC_QUERIES in FEATURE_FLAGS until caching is set up.
  3. After fixing, restart both the webserver and Celery workers — init_app runs in each.

Example fix

# before (superset_config.py)
FEATURE_FLAGS = {"GLOBAL_ASYNC_QUERIES": True}
# no CACHE_CONFIG / DATA_CACHE_CONFIG -> app fails to start

# after
from celery.schedules import crontab  # (not needed, placeholder import removal)
CACHE_CONFIG = {"CACHE_TYPE": "RedisCache", "CACHE_URL": "redis://redis:6379/1"}
DATA_CACHE_CONFIG = {"CACHE_TYPE": "RedisCache", "CACHE_URL": "redis://redis:6379/1"}
FEATURE_FLAGS = {"GLOBAL_ASYNC_QUERIES": True}
Defensive patterns

Strategy: validation

Validate before calling

def gaq_ready(cfg: dict) -> bool:
    for key in ("CACHE_CONFIG", "DATA_CACHE_CONFIG"):
        if cfg.get(key, {}).get("CACHE_TYPE") in (None, "null"):
            return False
    return True

assert gaq_ready(app.config) or not app.config["FEATURE_FLAGS"].get("GLOBAL_ASYNC_QUERIES")

Prevention

When it happens

Trigger: Setting FEATURE_FLAGS = {"GLOBAL_ASYNC_QUERIES": True} in superset_config.py while CACHE_CONFIG or DATA_CACHE_CONFIG is missing, set to {"CACHE_TYPE": "null"}, or still at the default null cache. init_app runs at webserver and worker startup, so the process refuses to boot.

Common situations: Minimal dev configs that never configured caching but flipped the GAQ flag on; deployments that disabled caching deliberately ("CACHE_TYPE": "null") for debugging and later enabled async queries without restoring caches; helm values where cache config keys are misnamed so they land in the wrong config dict.

Related errors


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