cube-js/cube · error
CacheStore cannot be used on the worker node! cache_set was
Error message
CacheStore cannot be used on the worker node! cache_set was used.
What it means
ClusterCacheStoreClient (worker-node CacheStore) panics on cache_set because workers must not write to the local cache store directly. Cache item creation/updates must be performed on the master node or via the cluster-distributed path. The panic names the offending method to make the misroute obvious.
Source
Thrown at rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs:1953
}
crate::di_service!(RocksCacheStore, [CacheStore]);
crate::di_service!(CacheStoreRpcClient, [CacheStore]);
pub struct ClusterCacheStoreClient {}
#[async_trait]
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.")
}
View on GitHub (pinned to 7d981676b3)
Solutions
- Send cache_set operations to the master node or use the cluster-aware cache client.
- Review node role configuration; make the writer a master or enable the proper cache delegation path.
- In code, resolve the CacheStore via the cluster/metastore so writes are delegated, not aimed at the worker stub.
Example fix
// before worker_cache_store.cache_set(item, true).await?; // panics on worker // after cluster_cache_client.cache_set(item, true).await?; // delegated via master
Defensive patterns
Strategy: validation
Validate before calling
if node_role() == Role::Worker {
return Err(CubeError::internal("cache_set is master-only"));
}
cache_store.cache_set(item, true).await?; Type guard
fn can_mutate_cache(store: &dyn CacheStore) -> bool {
std::any::Any::type_id(store) != std::any::TypeId::of::<ClusterCacheStoreClient>()
} Try / catch
if std::any::TypeId::of::<ClusterCacheStoreClient>() == store_type_id() {
return Err(CubeError::internal("cache_set must be routed via the master node"));
}
cache_store.cache_set(item, update_if_not_exists).await?; Prevention
- Route cache writes through the master or cluster delegation API
- Inject the correct CacheStore implementation based on node role
- Never broadcast cache writes to every cluster node
- Add role checks before invoking CacheStore mutation methods
When it happens
Trigger: Calling cache_set(item, update_if_not_exists) on a worker node's ClusterCacheStoreClient — e.g. result-cache write logic executed on a worker that assumed local cache ownership.
Common situations: Worker node receiving cache-write traffic intended for the master; misconfigured load balancing; custom tooling invoking cache APIs against a worker endpoint.
Related errors
- CacheStore cannot be used on the worker node! cache_all was
- CacheStore cannot be used on the worker node! cache_clear wa
- CacheStore cannot be used on the worker node! truncate was u
- 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/76fc3387a0590a30.
Report an issue: GitHub.