cube-js/cube · error
CacheStore cannot be used on the worker node! truncate was u
Error message
CacheStore cannot be used on the worker node! truncate was used.
What it means
ClusterCacheStoreClient (worker-node CacheStore) panics on truncate for the same reason as other methods: truncating the cache is master-only and workers must not touch local cache storage. It is a fail-fast guard against state divergence in the cluster.
Source
Thrown at rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs:1961
impl CacheStore for ClusterCacheStoreClient {
async fn cache_all(&self, _limit: Option<usize>) -> Result<Vec<IdRow<CacheItem>>, CubeError> {
panic!("CacheStore cannot be used on the worker node! cache_all was used.")
}
async fn cache_set(
&self,
_item: CacheItem,
_update_if_not_exists: bool,
) -> Result<bool, CubeError> {
panic!("CacheStore cannot be used on the worker node! cache_set was used.")
}
async fn cache_clear(&self) -> Result<(), CubeError> {
panic!("CacheStore cannot be used on the worker node! cache_clear was used.")
}
async fn truncate(&self) -> Result<(), CubeError> {
panic!("CacheStore cannot be used on the worker node! truncate was used.")
}
async fn cache_delete(&self, _key: String) -> Result<(), CubeError> {
panic!("CacheStore cannot be used on the worker node! cache_delete was used.")
}
async fn cache_get(&self, _key: String) -> Result<Option<IdRow<CacheItem>>, CubeError> {
panic!("CacheStore cannot be used on the worker node! cache_get was used.")
}
async fn cache_keys(&self, _prefix: String) -> Result<Vec<IdRow<CacheItem>>, CubeError> {
panic!("CacheStore cannot be used on the worker node! cache_keys was used.")
}
async fn cache_incr(&self, _: String) -> Result<IdRow<CacheItem>, CubeError> {
panic!("CacheStore cannot be used on the worker node! cache_incr was used.")
}
View on GitHub (pinned to 7d981676b3)
Solutions
- Run truncate on the master node only, which owns and coordinates cache storage.
- Exclude worker nodes from maintenance scripts that call CacheStore mutation methods.
- Reconfigure the node as master if it is intended to hold the cache.
Example fix
// before worker_cache_store.truncate().await?; // panics on worker // after master_cache_store.truncate().await?; // run maintenance on master
Defensive patterns
Strategy: validation
Validate before calling
if node_role() == Role::Worker {
return Err(CubeError::internal("truncate is master-only"));
}
cache_store.truncate().await?; Type guard
fn is_master_cache(store: &dyn CacheStore) -> bool {
std::any::Any::type_id(store) != std::any::TypeId::of::<ClusterCacheStoreClient>()
} Try / catch
if is_worker_cache_stub(cache_store) {
return Err(CubeError::internal("truncate must run on the master node"));
}
cache_store.truncate().await?; Prevention
- Run truncation maintenance exclusively on the master
- Exclude workers from destructive maintenance loops
- Verify deployment topology before wiping cache storage
- Gate truncate behind role checks in shared utilities
When it happens
Trigger: Calling truncate() on a worker node's ClusterCacheStoreClient, e.g. maintenance jobs wiping cache tables on every node.
Common situations: Maintenance/CI scripts running truncate against all cluster nodes; misrouting maintenance traffic to workers.
Related errors
- CacheStore cannot be used on the worker node! cache_all was
- CacheStore cannot be used on the worker node! cache_set was
- CacheStore cannot be used on the worker node! cache_clear wa
- CacheStore cannot be used on the worker node! cache_delete w
- CacheStore cannot be used on the worker node! cache_get was
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/14c95b0a05b1850c.
Report an issue: GitHub.