{"record":{"id":"c145f8f781a97c57","repo":"risingwavelabs/risingwave","slug":"should-have-been-handled","errorCode":null,"errorMessage":"should have been handled","messagePattern":"should have been handled","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/src/manager/sink_coordination/coordinator_worker.rs","lineNumber":416,"sourceCode":"                let event = match request {\n                    coordinate_request::Msg::CommitRequest(request) => {\n                        CoordinationHandleManagerEvent::CommitRequest {\n                            epoch: request.epoch,\n                            metadata: request.metadata.ok_or_else(|| anyhow!(\"empty sink metadata\"))?,\n                            schema_change: request.schema_change,\n                        }\n                    }\n                    coordinate_request::Msg::AlignInitialEpochRequest(epoch) => {\n                        CoordinationHandleManagerEvent::AlignInitialEpoch(epoch)\n                    }\n                    coordinate_request::Msg::UpdateVnodeRequest(_) => {\n                        CoordinationHandleManagerEvent::UpdateVnodeBitmap\n                    }\n                    coordinate_request::Msg::Stop(_) => {\n                        CoordinationHandleManagerEvent::Stop\n                    }\n                    coordinate_request::Msg::StartRequest(_) => {\n                        unreachable!(\"should have been handled\");\n                    }\n                };\n                Ok((handle_id, event))\n            }\n        }\n    }\n\n    fn vnode_bitmap(&self, handle_id: HandleId) -> &Bitmap {\n        self.writer_handles[&handle_id].vnode_bitmap()\n    }\n\n    fn stop_handle(&mut self, handle_id: HandleId) -> anyhow::Result<()> {\n        self.writer_handles\n            .remove(&handle_id)\n            .expect(\"should exist\")\n            .stop()\n    }\n","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/manager/sink_coordination/coordinator_worker.rs#L398-L434","documentation":"`next_event` matches on the received `coordinate_request::Msg` and maps each variant to an event; `StartRequest` should never appear at this point because start requests are handled earlier in `next_event` (when the handle is first registered). Hitting `unreachable!(\"should have been handled\")` means a `StartRequest` was dispatched through the inner request path anyway — a broken invariant in the request routing logic.","triggerScenarios":"A writer sends a second `StartRequest` after its handle is already registered and inserted, so the duplicate falls through `next_request_inner` into the `match` arm instead of being consumed by the registration path.","commonSituations":"Writer retry logic re-sending the start request after a timeout while the first one already registered the handle; bugs introduced when refactoring `next_event`'s select arms so start requests leak into the request stream; custom/test clients misusing the coordination protocol.","solutions":["Inspect the writer to ensure it sends `StartRequest` at most once per handle; add idempotency on the writer's retry path.","Handle `StartRequest` defensively in the `match` (e.g. log and skip) instead of panicking, if duplicates are plausible.","Review recent changes to `next_event`/`next_request_inner` that may have broken start-request routing.","Check meta-node logs for the sink id and handle id to identify which writer re-sent the request."],"exampleFix":"// before\ncoordinate_request::Msg::StartRequest(_) => {\n    unreachable!(\"should have been handled\");\n}\n\n// after\ncoordinate_request::Msg::StartRequest(_) => {\n    warn!(handle_id, \"duplicate StartRequest in request stream; ignoring\");\n    continue;\n}","handlingStrategy":"type-guard","validationCode":"// Ensure the writer sends StartRequest only once per handle\nlet mut start_sent = false;\nfn send_start(tx: &Sender<StartRequest>, start_sent: &mut bool) -> Result<()> {\n    ensure!(!*start_sent, \"StartRequest already sent\");\n    *start_sent = true;\n    tx.send(start_request)\n}","typeGuard":"fn is_registration_path(msg: &Msg) -> bool {\n    !matches!(msg, coordinate_request::Msg::StartRequest(_))\n}","tryCatchPattern":"coordinate_request::Msg::StartRequest(_) => {\n    warn!(handle_id, \"unexpected StartRequest in request stream; ignoring instead of panicking\");\n    continue;\n}","preventionTips":["Send StartRequest exactly once per writer handle","Route start handling only through the registration path","Prefer warn-and-skip over unreachable! for protocol messages"],"tags":["rust","panic","protocol-violation","sink-coordination"],"backgroundTag":"unexpected-response-shape","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"}