{"record":{"id":"9406a1d5df7ab4e9","repo":"risingwavelabs/risingwave","slug":"internal-error-entered-unreachable-code-9406a1","errorCode":null,"errorMessage":"internal error: entered unreachable code","messagePattern":"internal error: entered unreachable code","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/src/manager/notification.rs","lineNumber":286,"sourceCode":"                tracing::warn!(error = %err.as_report(), \"Failed to notify local subscriber\");\n                return false;\n            }\n            true\n        });\n    }\n\n    /// Tell `NotificationManagerCore` to delete sender.\n    pub fn delete_sender(&self, worker_type: WorkerType, worker_key: WorkerKey) {\n        let mut core_guard = self.core.lock();\n        // TODO: we may avoid passing the worker_type and remove the `worker_key` in all sender\n        // holders anyway\n        match worker_type {\n            WorkerType::Frontend => core_guard.frontend_senders.remove(&worker_key),\n            WorkerType::ComputeNode | WorkerType::RiseCtl => {\n                core_guard.hummock_senders.remove(&worker_key)\n            }\n            WorkerType::Compactor => core_guard.compactor_senders.remove(&worker_key),\n            _ => unreachable!(),\n        };\n    }\n\n    /// Tell `NotificationManagerCore` to insert sender by `worker_type`.\n    pub fn insert_sender(\n        &self,\n        subscribe_type: SubscribeType,\n        worker_key: WorkerKey,\n        sender: UnboundedSender<Notification>,\n    ) {\n        let mut core_guard = self.core.lock();\n        if core_guard.exiting {\n            tracing::warn!(\"notification manager exiting.\");\n            return;\n        }\n        let senders = core_guard.senders_of(subscribe_type);\n\n        senders.insert(worker_key, sender);","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/manager/notification.rs#L268-L304","documentation":"An `unreachable!()` panic in `NotificationManager::delete_sender`. The match on `WorkerType` handles Frontend, ComputeNode/RiseCtl, and Compactor, so hitting the wildcard arm means the worker key resolved to a WorkerType the code did not anticipate (e.g. Meta or a future/new variant).","triggerScenarios":"Calling `delete_sender` for a worker whose `WorkerType` is `Meta` or any newly introduced variant not covered by the match arms in notification.rs:280-287.","commonSituations":"Rust version/dependency change adds a WorkerType variant; internal cluster tooling registering as Meta worker then deregistering; a bug passing the wrong worker type to delete_sender.","solutions":["Identify the WorkerType value reaching the wildcard arm (add logging or inspect worker registration) and handle it in the match.","If a new WorkerType variant was added, update `delete_sender` (and sibling matches) to route it to the correct sender map or explicitly ignore it.","Reject/ignore deregistration attempts for worker types that never register senders (e.g. Meta) instead of panicking."],"exampleFix":"// before\nWorkerType::Compactor => core_guard.compactor_senders.remove(&worker_key),\n_ => unreachable!(),\n// after\nWorkerType::Compactor => core_guard.compactor_senders.remove(&worker_key),\nWorkerType::Meta => None, // no sender map to delete\n_ => None,","handlingStrategy":"try-catch","validationCode":"// this panics, not returns — guard before calling by checking the worker type\nfn deletable(t: WorkerType) -> bool {\n    matches!(t, WorkerType::Frontend | WorkerType::ComputeNode | WorkerType::RiseCtl | WorkerType::Compactor)\n}","typeGuard":"fn is_sender_backed(t: &WorkerType) -> bool {\n    !matches!(t, WorkerType::Meta)\n}","tryCatchPattern":"// panic-based: cannot catch; instead ensure callers only pass known variants\nif !is_sender_backed(&worker_type) { return; } // skip deregistration","preventionTips":["Keep WorkerType match arms exhaustive in all notification manager functions","After adding a WorkerType variant, run `cargo check` to surface non-exhaustive matches","Never deregister worker types that do not own senders"],"tags":["meta","notification","unreachable","panic"],"backgroundTag":"invalid-enum-value","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}