{"record":{"id":"06bb249a9ec30f62","repo":"zed-industries/zed","slug":"display-point-out-of-range","errorCode":null,"errorMessage":"display point out of range","messagePattern":"display point out of range","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/editor/src/display_map/fold_map.rs","lineNumber":147,"sourceCode":"\n    #[ztracing::instrument(skip_all)]\n    pub fn to_inlay_point(self, snapshot: &FoldSnapshot) -> InlayPoint {\n        let (start, _, _) = snapshot\n            .transforms\n            .find::<Dimensions<FoldPoint, InlayPoint>, _>((), &self, Bias::Right);\n        let overshoot = self.0 - start.0.0;\n        InlayPoint(start.1.0 + overshoot)\n    }\n\n    #[ztracing::instrument(skip_all)]\n    pub fn to_offset(self, snapshot: &FoldSnapshot) -> FoldOffset {\n        let (start, _, item) = snapshot\n            .transforms\n            .find::<Dimensions<FoldPoint, TransformSummary>, _>((), &self, Bias::Right);\n        let overshoot = self.0 - start.1.output.lines;\n        let mut offset = start.1.output.len;\n        if !overshoot.is_zero() {\n            let transform = item.expect(\"display point out of range\");\n            assert!(transform.placeholder.is_none());\n            let end_inlay_offset = snapshot\n                .inlay_snapshot\n                .to_offset(InlayPoint(start.1.input.lines + overshoot));\n            offset += end_inlay_offset.0 - start.1.input.len;\n        }\n        FoldOffset(offset)\n    }\n}\n\nimpl<'a> sum_tree::Dimension<'a, TransformSummary> for FoldPoint {\n    fn zero(_cx: ()) -> Self {\n        Default::default()\n    }\n\n    fn add_summary(&mut self, summary: &'a TransformSummary, _: ()) {\n        self.0 += &summary.output.lines;\n    }","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/editor/src/display_map/fold_map.rs#L129-L165","documentation":"An internal invariant guard in FoldPoint::to_offset: converting a FoldPoint to a FoldOffset queries the fold map's transform summary and panics if the given display point lies beyond the map's extent. In practice this means the point was computed against a different (stale or newer) snapshot than the one passed in, or a caller passed an unclamped end-of-buffer point; the fold map only covers rows/folds present in this snapshot.","triggerScenarios":"Thrown at crates/editor/src/display_map/fold_map.rs:147 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Clamp the FoldPoint to snapshot.max_point()/extent before converting","Ensure points and snapshots are taken from the same display map revision — never mix a point from one snapshot with another","In callers like chunks_at/chars_at, operate on the snapshot the point was derived from, or re-anchor the point first"],"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-14T05:17:10.506Z"}