apache/superset · error · TemporaryCacheDeleteFailedError

An error occurred while deleting the value.

Error message

An error occurred while deleting the value.

What it means

TemporaryCacheDeleteFailedError is raised by the explore form_data delete command when any step inside run() — cache get, access checks, or the two cache deletes — surfaces a SQLAlchemyError. The command logs the full exception and re-raises this wrapper, so the root cause lives in the chained exception and the server log.

Source

Thrown at superset/commands/explore/form_data/delete.py:65

                key
            )
            if state:
                datasource_id: int = state["datasource_id"]
                chart_id: Optional[int] = state["chart_id"]
                datasource_type = DatasourceType(state["datasource_type"])
                check_access(datasource_id, chart_id, datasource_type)
                if state["owner"] != get_user_id():
                    raise TemporaryCacheAccessDeniedError()
                tab_id = self._cmd_params.tab_id
                contextual_key = cache_key(
                    session.get("_id"), tab_id, datasource_id, chart_id, datasource_type
                )
                cache_manager.explore_form_data_cache.delete(contextual_key)
                return cache_manager.explore_form_data_cache.delete(key)
            return False
        except SQLAlchemyError as ex:
            logger.exception("Error running delete command")
            raise TemporaryCacheDeleteFailedError() from ex

    def validate(self) -> None:
        pass

View on GitHub (pinned to f4587218dd)

Solutions

  1. Read the chained SQLAlchemyError in logs ('Error running delete command') to identify the failing statement.
  2. Restore/verify metadata DB health, then retry the delete.
  3. Enable pool_pre_ping and sane pool_recycle in SQLALCHEMY_DATABASE_URI options to avoid stale connections.
  4. If the key is already gone server-side, treat a failed delete as benign: the cache entry expires by CACHE_DEFAULT_TIMEOUT anyway.
Defensive patterns

Strategy: retry

Try / catch

try:
    DeleteTemporaryExploreStateCommand(...).run()
except TemporaryCacheDeleteFailedError as ex:
    if is_transient(ex.__cause__):  # SQLAlchemyError underneath
        retry_once()
    else:
        log_and_ignore()  # entries expire via CACHE_DEFAULT_TIMEOUT anyway

Prevention

When it happens

Trigger: DELETE /explore JSON call while the metadata database errors (connection lost, pool exhausted, constraint failure on session-related tables) mid-delete of the temporary explore state.

Common situations: Metadata DB failover during an explore session cleanup. Pooled connections killed by a LB idle timeout between the get and the delete. Concurrent deletes racing on session rows.

Related errors


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