{"record":{"id":"fa42f0b96a390b47","repo":"zed-industries/zed","slug":"checked-above","errorCode":null,"errorMessage":"checked above","messagePattern":"checked above","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/editor/src/selection.rs","lineNumber":754,"sourceCode":"                    goal: SelectionGoal::None,\n                    reversed: selection.reversed,\n                }\n            })\n            .collect::<Vec<_>>();\n\n        if !selected_larger_node {\n            return; // don't put this call in the history\n        }\n\n        // scroll based on transformation done to the last selection created by the user\n        let (last_old, last_new) = old_selections\n            .last()\n            .zip(new_selections.last().cloned())\n            .expect(\"old_selections isn't empty\");\n\n        let is_selection_reversed = if new_selections.len() == 1 {\n            let should_be_reversed = last_old.start != last_new.start;\n            new_selections.last_mut().expect(\"checked above\").reversed = should_be_reversed;\n            should_be_reversed\n        } else {\n            last_new.reversed\n        };\n\n        self.select_syntax_node_history.disable_clearing = true;\n        self.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {\n            s.select(new_selections.clone());\n        });\n        self.select_syntax_node_history.disable_clearing = false;\n\n        let start_row = last_new.start.to_display_point(&display_map).row().0;\n        let end_row = last_new.end.to_display_point(&display_map).row().0;\n        let selection_height = end_row - start_row + 1;\n        let scroll_margin_rows = self.vertical_scroll_margin() as u32;\n\n        let fits_on_the_screen = visible_row_count >= selection_height + scroll_margin_rows * 2;\n        let scroll_behavior = if fits_on_the_screen {","sourceCodeStart":736,"sourceCodeEnd":772,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/editor/src/selection.rs#L736-L772","documentation":"Companion expect to the 'old_selections isn't empty' guard in select_larger_syntax_node ('checked above'): the same zip of the last old and new selections assumes at least one prior selection existed when the selection-expansion was recorded. It fires when that earlier check is bypassed — e.g. a refactor moves or removes the early return — leaving an empty old_selections list to reach the history push.","triggerScenarios":"Thrown at crates/editor/src/selection.rs:754 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace the expect with an explicit if let Some((last_old, last_new)) = ...zip(...) and skip autoscroll when absent","Keep the emptiness check adjacent to the use so 'checked above' cannot drift","Add a test covering select_larger_syntax_node with no prior selections"],"exampleFix":null,"handlingStrategy":"validation","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-14T00:17:10.932Z"}