{"record":{"id":"dde0e3105978e830","repo":"zed-industries/zed","slug":"not-supported","errorCode":null,"errorMessage":"not supported","messagePattern":"not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/multi_buffer/src/multi_buffer.rs","lineNumber":5484,"sourceCode":"        if !ranges_are_ordered {\n            return text_anchor_ranges\n                .into_iter()\n                .map(|range| self.buffer_anchor_range_to_anchor_range(range))\n                .collect();\n        }\n\n        let path_key = buffer_state.path_key.clone();\n        let mut cursor = self.excerpts.cursor::<PathKey>(());\n        cursor.seek_forward(&path_key, Bias::Left);\n        let excerpts = iter::from_fn(move || {\n            let excerpt = cursor.item()?;\n            if excerpt.path_key != path_key {\n                return None;\n            }\n            cursor.next();\n            Some(excerpt)\n        })\n        .collect::<Vec<_>>();\n        let mut first_candidate_index = 0;\n        text_anchor_ranges\n            .into_iter()\n            .map(|range| {\n                while let Some(excerpt) = excerpts.get(first_candidate_index) {\n                    let buffer_snapshot = excerpt.buffer_snapshot(self);\n                    if excerpt\n                        .range\n                        .context\n                        .end\n                        .cmp(&range.start, buffer_snapshot)\n                        .is_lt()\n                    {\n                        first_candidate_index += 1;\n                        continue;\n                    }\n                    break;\n                }","sourceCodeStart":5466,"sourceCodeEnd":5502,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/crates/multi_buffer/src/multi_buffer.rs#L5466-L5502","documentation":"When multibuffer APIs convert a caller-supplied range to offsets (excerpt boundaries and offset math), the start bound must be Included or Unbounded. Rust has no exclusive-start range syntax, but callers can construct one manually with (Bound::Excluded(x), ...). That form is explicitly rejected here and panics with 'not supported'.","triggerScenarios":"Passing a bound pair whose start is Bound::Excluded - e.g. (Bound::Excluded(start), Bound::Included(end)) built by generic range-manipulation code - into multibuffer range APIs such as excerpt_boundaries that convert the start bound to an offset.","commonSituations":"Generic adapters that translate user ranges, regex matches, or interval-arithmetic results into Bound pairs and forward them; code ported from other containers that accept exclusive starts; hand-built ranges in tests.","solutions":["Normalize the start bound before calling: convert Excluded(o) to Included(o + 1) for discrete offsets","Otherwise only pass Included or Unbounded start bounds to these APIs","Centralize range construction in one helper that clamps/normalizes bounds for every caller"],"exampleFix":"// before\nlet bounds = (Bound::Excluded(start), Bound::Included(end));\nlet boundaries = snapshot.excerpt_boundaries((bounds.0, bounds.1)); // panics\n\n// after: normalize the start bound\nlet start_bound = match bounds.0 {\n    Bound::Excluded(offset) => Bound::Included(offset + 1),\n    bound => bound,\n};\nlet boundaries = snapshot.excerpt_boundaries((start_bound, bounds.1));","handlingStrategy":"validation","validationCode":"// normalize the start bound before calling range APIs\nfn normalize_start<T>(bound: Bound<T>, next: impl Fn(T) -> T) -> Bound<T> {\n    match bound {\n        Bound::Excluded(value) => Bound::Included(next(value)),\n        bound => bound,\n    }\n}\n\nlet start = normalize_start((start, end).0, |offset| offset + 1);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-construct Bound::Excluded start bounds for multibuffer range APIs","Centralize range construction in one helper that normalizes bounds for every caller","Unit-test range adapters with all start/end Bound combinations"],"tags":["zed","multi-buffer","range","bounds","api-misuse"],"backgroundTag":"unsupported-range-bound","analyzedSha":"916fc2b8cb3a815cbef4a3b40e13081be72036b6","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}