{"record":{"id":"901571ad5987b13d","repo":"cube-js/cube","slug":"cachestore-cannot-be-used-on-the-worker-node-cach-901571","errorCode":null,"errorMessage":"CacheStore cannot be used on the worker node! cache_get was used.","messagePattern":"CacheStore cannot be used on the worker node! cache_get was used\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs","lineNumber":1969,"sourceCode":"        _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\n    async fn queue_results_all(\n        &self,\n        _limit: Option<usize>,\n    ) -> Result<Vec<IdRow<QueueResult>>, CubeError> {","sourceCodeStart":1951,"sourceCodeEnd":1987,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs#L1951-L1987","documentation":"ClusterCacheStoreClient (worker-node CacheStore) panics on cache_get; workers are not a source of cached items. Reads, like writes, must be served by the master node's cache store or the cluster path.","triggerScenarios":"Calling cache_get(key) on a worker node's ClusterCacheStoreClient — e.g. a lookup that assumed it was talking to the node holding the cache.","commonSituations":"Read-path code accidentally constructed with the worker client; services pointed at a worker endpoint for cache lookups.","solutions":["Perform cache_get against the master node / cluster cache client.","Fix dependency injection so the read path receives the appropriate CacheStore implementation for its role.","Verify the node's cluster role before issuing cache reads."],"exampleFix":"// before\nlet item = worker_cache_store.cache_get(key).await?; // panics on worker\n// after\nlet item = cluster.master_cache_store().cache_get(key).await?;","handlingStrategy":"validation","validationCode":"if node_role() == Role::Worker {\n    return Err(CubeError::internal(\"cache_get is master-only\"));\n}\nlet item = cache_store.cache_get(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 reads must target the master node\"));\n}\nlet item = cache_store.cache_get(key).await?;","preventionTips":["Point cache reads at the master/head node","Fix service endpoints so lookups do not hit worker instances","Verify node role before constructing cache-reading services","Use the shared cluster cache client in common read paths"],"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"}