{"record":{"id":"4dab858dd9461b13","repo":"zed-industries/zed","slug":"added-1","errorCode":null,"errorMessage":"added 1","messagePattern":"added 1","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/go_to_line/src/cursor_position.rs","lineNumber":63,"sourceCode":"        let (line, character) =\n            if let Some((buffer_snapshot, point)) = snapshot.point_to_buffer_point(selection_end) {\n                let line_start = Point::new(point.row, 0);\n\n                let chars_to_last_position = buffer_snapshot\n                    .text_summary_for_range::<text::TextSummary, _>(line_start..point)\n                    .chars as u32;\n                (line_start.row, chars_to_last_position)\n            } else {\n                let line_start = Point::new(selection_end.row, 0);\n\n                let chars_to_last_position = snapshot\n                    .text_summary_for_range::<MBTextSummary, _>(line_start..selection_end)\n                    .chars as u32;\n                (selection_end.row, chars_to_last_position)\n            };\n\n        Self {\n            line: NonZeroU32::new(line + 1).expect(\"added 1\"),\n            character: NonZeroU32::new(character + 1).expect(\"added 1\"),\n        }\n    }\n}\n\nimpl CursorPosition {\n    pub fn new(workspace: &Workspace) -> Self {\n        Self {\n            position: None,\n            context: None,\n            selected_count: Default::default(),\n            workspace: workspace.weak_handle(),\n            update_position: Task::ready(()),\n            _observe_active_editor: None,\n        }\n    }\n\n    fn update_position(","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/go_to_line/src/cursor_position.rs#L45-L81","documentation":"An arithmetic invariant in the cursor position formatter: after computing the 0-based column (buffer chars since line start), it converts to a 1-based human position via a checked add whose expect message is 'added 1'. It can only fire if the column value is already at u32::MAX — unreachable for real buffer contents — so this panic effectively signals integer overflow in the position math rather than any plausible editor state.","triggerScenarios":"Thrown at crates/go_to_line/src/cursor_position.rs:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use saturating_add(1) so an outlandish column clamps instead of panicking","Compute the column in usize and cast at the end, making overflow practically impossible","Replace expect with unwrap_or(u32::MAX) plus a debug log for the impossible case"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}