{"record":{"id":"f4e3337be6b1ff0d","repo":"cube-js/cube","slug":"cachestore-cannot-be-used-on-the-worker-node-cach","errorCode":null,"errorMessage":"CacheStore cannot be used on the worker node! cache_all was used.","messagePattern":"CacheStore cannot be used on the worker node! cache_all was used\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs","lineNumber":1945,"sourceCode":"    async fn wipe(&self) -> Result<(), CubeError> {\n        // Wiping requires dropping and reopening the RocksDB from scratch, which a bare inner\n        // store cannot do to itself (it cannot rebuild its own Arc / swap the state). The\n        // registered production impl is always LazyRocksCacheStore, which owns the teardown.\n        Err(CubeError::internal(\n            \"cachestore wipe is only supported through LazyRocksCacheStore\".to_string(),\n        ))\n    }\n}\n\ncrate::di_service!(RocksCacheStore, [CacheStore]);\ncrate::di_service!(CacheStoreRpcClient, [CacheStore]);\n\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","sourceCodeStart":1927,"sourceCodeEnd":1963,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs#L1927-L1963","documentation":"ClusterCacheStoreClient is the CacheStore implementation used on Cube Store worker nodes in a cluster. Workers do not own the local rocksdb cache — all cache mutations are supposed to go through the cluster/metastore path — so every CacheStore trait method panics with a message naming the method that was used. Seeing this means code invoked a local-cache operation directly on a worker node.","triggerScenarios":"Calling cache_all() on a ClusterCacheStoreClient (worker-node cache store), e.g. via cache-management/eviction logic that assumes it is running on a master node.","commonSituations":"Misconfigured cluster where a node started as worker receives master-only cache requests; application or admin tooling hitting the wrong node's endpoint; a bug routing cache operations through the wrong CacheStore instance.","solutions":["Ensure the operation runs on the master/head node, not a worker — route cache management calls to the master.","Check node configuration (cluster role flags) so cache-owning roles are assigned to the node performing cache operations.","If writing Cube Store code, obtain the shared/cluster cache client (e.g. from the metastore) instead of the worker-local ClusterCacheStoreClient."],"exampleFix":"// before\nlet items = worker_cache_store.cache_all(limit).await?; // panics on worker\n// after\nlet items = cluster.master_cache_store().cache_all(limit).await?; // route via master","handlingStrategy":"validation","validationCode":"// before calling cache_all, confirm the store is not the worker stub\nif store_is_worker_client(cache_store) {\n    return Err(\"cache_all must run on the master node\".into());\n}\nlet items = cache_store.cache_all(limit).await?;","typeGuard":"fn is_cluster_worker_client(store: &dyn CacheStore) -> bool {\n    // ClusterCacheStoreClient is the worker stub; detect via downcast or role flag\n    std::any::Any::type_id(store) == std::any::TypeId::of::<ClusterCacheStoreClient>() || node_role() == Role::Worker\n}","tryCatchPattern":"// panics are not catchable in Rust; guard before calling\nif node_role() == Role::Worker {\n    return Err(CubeError::internal(\"cache_all is master-only\"));\n}\nlet items = cache_store.cache_all(limit).await?;","preventionTips":["Only issue cache management operations against the master/head node","Check node role flags at startup and refuse cache ops on workers","Use the cluster-aware cache client instead of node-local clients in shared code","Document which endpoints are master-only for ops tooling"],"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"}