{"record":{"id":"10bae8f1d1599271","repo":"cube-js/cube","slug":"cachestore-cannot-be-used-on-the-worker-node-cach-10bae8","errorCode":null,"errorMessage":"CacheStore cannot be used on the worker node! cache_clear was used.","messagePattern":"CacheStore cannot be used on the worker node! cache_clear was used\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs","lineNumber":1957,"sourceCode":"\npub struct ClusterCacheStoreClient {}\n\n#[async_trait]\nimpl CacheStore for ClusterCacheStoreClient {\n    async fn cache_all(&self, _limit: Option<usize>) -> Result<Vec<IdRow<CacheItem>>, CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! cache_all was used.\")\n    }\n\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","sourceCodeStart":1939,"sourceCodeEnd":1975,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs#L1939-L1975","documentation":"ClusterCacheStoreClient (worker-node CacheStore) panics on cache_clear because clearing the cache is a master-owned operation; workers have no local cache authority. The panic prevents workers from silently diverging from the master's cache state.","triggerScenarios":"Calling cache_clear() on a worker node's ClusterCacheStoreClient, e.g. an admin/eviction routine issuing a cache flush to every node in the cluster.","commonSituations":"Cluster-wide 'flush cache' tooling that broadcasts to all nodes including workers; ops scripts targeting the wrong node's API.","solutions":["Issue cache_clear only to the master/head node so it propagates cluster-wide.","Update cluster administration tooling to filter worker nodes out of cache-management calls.","Verify node roles; if this node should own the cache, start it with master configuration."],"exampleFix":"// before\nfor node in all_nodes { node.cache_store.cache_clear().await?; } // panics on workers\n// after\nmaster_node.cache_store.cache_clear().await?; // master clears for the cluster","handlingStrategy":"validation","validationCode":"if node_role() == Role::Worker {\n    return Err(CubeError::internal(\"cache_clear is master-only\"));\n}\ncache_store.cache_clear().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(\"send cache_clear to the master node\"));\n}\ncache_store.cache_clear().await?;","preventionTips":["Send cache flushes only to the master node","Filter worker nodes out of cluster-wide admin scripts","Confirm node role configuration before running maintenance","Use cluster-level flush APIs if available"],"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"}