{"record":{"id":"b038d403cb86979e","repo":"risingwavelabs/risingwave","slug":"invalid-hummock-context-0","errorCode":null,"errorMessage":"invalid hummock context {0}","messagePattern":"invalid hummock context (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/meta/src/hummock/error.rs","lineNumber":28,"sourceCode":"// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nuse risingwave_common::catalog::TableId;\nuse risingwave_hummock_sdk::{HummockContextId, HummockSstableObjectId};\nuse risingwave_object_store::object::ObjectError;\nuse risingwave_rpc_client::error::ToTonicStatus;\nuse sea_orm::DbErr;\nuse thiserror::Error;\n\nuse crate::model::MetadataModelError;\n\npub type Result<T> = std::result::Result<T, Error>;\n\n#[derive(Error, Debug)]\npub enum Error {\n    #[error(\"invalid hummock context {0}\")]\n    InvalidContext(HummockContextId),\n    #[error(\"failed to access meta store\")]\n    MetaStore(\n        #[source]\n        #[backtrace]\n        anyhow::Error,\n    ),\n    #[error(transparent)]\n    ObjectStore(\n        #[from]\n        #[backtrace]\n        ObjectError,\n    ),\n    #[error(\"compactor {0} is disconnected\")]\n    CompactorUnreachable(HummockContextId),\n    #[error(\"compaction group error: {0}\")]\n    CompactionGroup(String),\n    #[error(\"SST {0} is invalid\")]","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/hummock/error.rs#L10-L46","documentation":"hummock::Error::InvalidContext indicates that a Hummock operation referenced a context id (HummockContextId — typically a worker/node identifier registered with Hummock) that is unknown or no longer valid. The meta node's Hummock manager keeps a registry of active contexts (compactors, compute nodes); operating on an unregistered or evicted context raises this error.","triggerScenarios":"Calling Hummock meta APIs (e.g. unpin, register/scan, commit epoch ops) with a context id of a node that was removed from the cluster, restarted and re-registered under a new id, or never registered.","commonSituations":"A compute node or compactor was killed and rejoined (its old context id got cleaned up); stale references in compaction tasks after node removal; race between node deregistration and in-flight Hummock requests.","solutions":["Identify the stale context id from the error message and check if the node re-registered with a new id","Re-register the node/worker with the Hummock meta service and retry with the new context id","Clear stale pinning/version state for the old context id","Check for race conditions in cluster membership changes (node removal vs in-flight requests)"],"exampleFix":"// before\nhummock_meta.unpin_snapshot(old_context_id, pinned).await?;\n// after\nlet ctx = hummock_meta.get_context_id(worker_node_id).await\n    .expect(\"worker re-registered\");\nhummock_meta.unpin_snapshot(ctx, pinned).await?;","handlingStrategy":"retry","validationCode":"// Verify the worker is registered before issuing Hummock ops\nlet ctx_id = hummock_meta.get_context_id(worker_node_id).await\n    .map_err(|_| \"worker not registered with hummock\")?;","typeGuard":"fn is_invalid_context(e: &hummock::Error) -> Option<HummockContextId> {\n    match e { hummock::Error::InvalidContext(id) => Some(*id), _ => None }\n}","tryCatchPattern":"match hummock_result {\n    Err(hummock::Error::InvalidContext(ctx)) => {\n        // re-resolve context id after re-registration, then retry once\n        let new_ctx = hummock_meta.get_context_id(worker_node_id).await?;\n        retry_with_context(new_ctx)\n    }\n    other => other?,\n}","preventionTips":["Always derive the context id from the current worker registration, not cached state","Handle node restarts: ids change after re-registration","Subscribe to cluster membership changes and invalidate cached context ids","Deregister nodes cleanly before terminating them"],"tags":["hummock","statestore","cluster-membership"],"backgroundTag":"resource-not-found","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}