{"record":{"id":"2c5171cae6b0a143","repo":"cube-js/cube","slug":"cachestore-cannot-be-used-on-the-worker-node-cach-2c5171","errorCode":null,"errorMessage":"CacheStore cannot be used on the worker node! cache_delete was used.","messagePattern":"CacheStore cannot be used on the worker node! cache_delete was used\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs","lineNumber":1965,"sourceCode":"\n    async fn cache_set(\n        &self,\n        _item: CacheItem,\n        _update_if_not_exists: bool,\n    ) -> Result<bool, CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! cache_set was used.\")\n    }\n\n    async fn cache_clear(&self) -> Result<(), CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! cache_clear was used.\")\n    }\n\n    async fn truncate(&self) -> Result<(), CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! truncate was used.\")\n    }\n\n    async fn cache_delete(&self, _key: String) -> Result<(), CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! cache_delete was used.\")\n    }\n\n    async fn cache_get(&self, _key: String) -> Result<Option<IdRow<CacheItem>>, CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! cache_get was used.\")\n    }\n\n    async fn cache_keys(&self, _prefix: String) -> Result<Vec<IdRow<CacheItem>>, CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! cache_keys was used.\")\n    }\n\n    async fn cache_incr(&self, _: String) -> Result<IdRow<CacheItem>, CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! cache_incr was used.\")\n    }\n\n    async fn queue_all(&self, _limit: Option<usize>) -> Result<Vec<QueueAllItem>, CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! queue_all was used.\")\n    }\n","sourceCodeStart":1947,"sourceCodeEnd":1983,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs#L1947-L1983","documentation":"ClusterCacheStoreClient (worker-node CacheStore) panics on cache_delete; workers do not perform individual cache-key deletions locally. Deletes must go through the master/cluster cache path to keep eviction consistent across the cluster.","triggerScenarios":"Calling cache_delete(key) on a worker node's ClusterCacheStoreClient — e.g. invalidating a specific query cache entry on the wrong node.","commonSituations":"Cache-invalidation hooks executing on workers; API routing sending invalidation requests to worker instances.","solutions":["Direct cache_delete calls to the master node or the cluster cache client.","Use the cluster-aware invalidation API so the delete is applied where the cache lives.","Check role configuration and request routing for the invalidating component."],"exampleFix":"// before\nworker_cache_store.cache_delete(key).await?; // panics on worker\n// after\ncluster_cache_client.cache_delete(key).await?; // invalidated via master","handlingStrategy":"validation","validationCode":"if node_role() == Role::Worker {\n    return Err(CubeError::internal(\"cache_delete is master-only\"));\n}\ncache_store.cache_delete(key).await?;","typeGuard":"fn is_master_cache(store: &dyn CacheStore) -> bool {\n    std::any::Any::type_id(store) != std::any::TypeId::of::<ClusterCacheStoreClient>()\n}","tryCatchPattern":"if is_worker_cache_stub(cache_store) {\n    return Err(CubeError::internal(\"cache_delete must be delegated to the master\"));\n}\ncache_store.cache_delete(key).await?;","preventionTips":["Route invalidation requests to the master node","Use the cluster invalidation API rather than per-node deletes","Check request routing for cache invalidation endpoints","Inject the role-appropriate CacheStore at construction time"],"tags":["rust","cubestore","cluster","cache","worker-node"],"backgroundTag":"cache-store-worker-node-unsupported","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}