{"record":{"id":"d4cf502e0c473282","repo":"zed-industries/zed","slug":"checked-for-type-drag-state-type-above","errorCode":null,"errorMessage":"checked for type drag state type above","messagePattern":"checked for type drag state type above","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui/src/elements/div.rs","lineNumber":2906,"sourceCode":"            }\n        }\n\n        let drag_cursor_style = self.base_style.as_ref().mouse_cursor;\n\n        let mut drag_listener = mem::take(&mut self.drag_listener);\n        let drop_listeners = mem::take(&mut self.drop_listeners);\n        let click_listeners = mem::take(&mut self.click_listeners);\n        let aux_click_listeners = mem::take(&mut self.aux_click_listeners);\n        let can_drop_predicate = mem::take(&mut self.can_drop_predicate);\n\n        if !drop_listeners.is_empty() {\n            let hitbox = hitbox.clone();\n            window.on_mouse_event({\n                move |_: &MouseUpEvent, phase, window, cx| {\n                    if let Some(drag) = &cx.active_drag\n                        && phase == DispatchPhase::Bubble\n                        && hitbox.is_hovered(window)\n                    {\n                        let drag_state_type = drag.value.as_ref().type_id();\n                        for (drop_state_type, listener) in &drop_listeners {\n                            if *drop_state_type == drag_state_type {\n                                let drag = cx\n                                    .active_drag\n                                    .take()\n                                    .expect(\"checked for type drag state type above\");\n\n                                let mut can_drop = true;\n                                if let Some(predicate) = &can_drop_predicate {\n                                    can_drop = predicate(drag.value.as_ref(), window, cx);\n                                }\n\n                                if can_drop {\n                                    listener(drag.value.as_ref(), window, cx);\n                                    window.refresh();\n                                    cx.stop_propagation();\n                                }","sourceCodeStart":2888,"sourceCodeEnd":2924,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui/src/elements/div.rs#L2888-L2924","documentation":"In Div's drop-listener dispatch, the active drag is downcast to the drag state type; the comment says the type was checked above (the listener was only registered for matching drags), so the expect firing means the registration-side type check and the dispatch-side downcast disagree — an internal invariant break.","triggerScenarios":"Thrown at crates/gpui/src/elements/div.rs:2788 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Compare the type check where the drop listener is registered with the downcast at dispatch","Ensure can_drop_predicate/listener registration filters by the same drag type T","Treat as a GPUI bug; reproduce with a minimal drag-and-drop of the mismatched state type"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}