{"record":{"id":"f3b6096e31a2715a","repo":"cube-js/cube","slug":"cachestore-cannot-be-used-on-the-worker-node-cach-f3b609","errorCode":null,"errorMessage":"CacheStore cannot be used on the worker node! cache_keys was used.","messagePattern":"CacheStore cannot be used on the worker node! cache_keys was used\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs","lineNumber":1973,"sourceCode":"\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> {\n        panic!(\"CacheStore cannot be used on the worker node! queue_results_all was used.\")\n    }\n\n    async fn queue_results_multi_delete(&self, _ids: Vec<u64>) -> Result<(), CubeError> {","sourceCodeStart":1955,"sourceCodeEnd":1991,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs#L1955-L1991","documentation":"ClusterCacheStoreClient (worker-node CacheStore) panics on cache_keys; listing cache keys is a master-owned operation since only the master's rocksdb cache holds the actual items. Workers panic to prevent empty/misleading listings.","triggerScenarios":"Calling cache_keys(prefix) on a worker node's ClusterCacheStoreClient — e.g. admin UI enumerating cache entries and iterating over all cluster nodes.","commonSituations":"Cache inspection dashboards hitting worker APIs; monitoring scripts broadcasting key-list calls cluster-wide.","solutions":["Call cache_keys on the master node to list cluster cache entries.","Update monitoring/admin tooling to only query the master for cache listings.","Re-check deployment topology so inspection tools target the head node."],"exampleFix":"// before\nlet keys = worker_cache_store.cache_keys(prefix).await?; // panics on worker\n// after\nlet keys = master_cache_store.cache_keys(prefix).await?;","handlingStrategy":"validation","validationCode":"if node_role() == Role::Worker {\n    return Err(CubeError::internal(\"cache_keys is master-only\"));\n}\nlet keys = cache_store.cache_keys(prefix).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(\"list cache keys via the master node\"));\n}\nlet keys = cache_store.cache_keys(prefix).await?;","preventionTips":["Enumerate cache entries only on the master node","Configure dashboards/monitoring to query the head node","Do not broadcast cache listing calls to all nodes","Record node roles in service discovery to ease routing"],"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"}