{"record":{"id":"14c95b0a05b1850c","repo":"cube-js/cube","slug":"cachestore-cannot-be-used-on-the-worker-node-trun","errorCode":null,"errorMessage":"CacheStore cannot be used on the worker node! truncate was used.","messagePattern":"CacheStore cannot be used on the worker node! truncate was used\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs","lineNumber":1961,"sourceCode":"impl 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\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","sourceCodeStart":1943,"sourceCodeEnd":1979,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs#L1943-L1979","documentation":"ClusterCacheStoreClient (worker-node CacheStore) panics on truncate for the same reason as other methods: truncating the cache is master-only and workers must not touch local cache storage. It is a fail-fast guard against state divergence in the cluster.","triggerScenarios":"Calling truncate() on a worker node's ClusterCacheStoreClient, e.g. maintenance jobs wiping cache tables on every node.","commonSituations":"Maintenance/CI scripts running truncate against all cluster nodes; misrouting maintenance traffic to workers.","solutions":["Run truncate on the master node only, which owns and coordinates cache storage.","Exclude worker nodes from maintenance scripts that call CacheStore mutation methods.","Reconfigure the node as master if it is intended to hold the cache."],"exampleFix":"// before\nworker_cache_store.truncate().await?; // panics on worker\n// after\nmaster_cache_store.truncate().await?; // run maintenance on master","handlingStrategy":"validation","validationCode":"if node_role() == Role::Worker {\n    return Err(CubeError::internal(\"truncate is master-only\"));\n}\ncache_store.truncate().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(\"truncate must run on the master node\"));\n}\ncache_store.truncate().await?;","preventionTips":["Run truncation maintenance exclusively on the master","Exclude workers from destructive maintenance loops","Verify deployment topology before wiping cache storage","Gate truncate behind role checks in shared utilities"],"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"}