{"record":{"id":"5f1107ba56e9802c","repo":"zed-industries/zed","slug":"a-multi-buffer-in-prompt-isn-t-possible","errorCode":null,"errorMessage":"A multi buffer in prompt isn't possible","messagePattern":"A multi buffer in prompt isn't possible","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/editor/src/editor.rs","lineNumber":12610,"sourceCode":"    fn set_masked(&self, masked: bool, _window: &mut Window, cx: &mut App) {\n        self.0.update(cx, |editor, cx| {\n            editor.set_masked(masked, cx);\n        });\n    }\n\n    fn set_read_only(&self, read_only: bool, cx: &mut App) {\n        self.0.update(cx, |editor, cx| {\n            editor.set_read_only(read_only);\n            cx.notify();\n        });\n    }\n}\nimpl<T> Default for InvalidationStack<T> {\n    fn default() -> Self {\n        Self(Default::default())\n    }\n}\n\nimpl<T> Deref for InvalidationStack<T> {\n    type Target = Vec<T>;\n\n    fn deref(&self) -> &Self::Target {\n        &self.0\n    }\n}\n\nimpl<T> DerefMut for InvalidationStack<T> {\n    fn deref_mut(&mut self) -> &mut Self::Target {\n        &mut self.0\n    }\n}\n\nimpl InvalidationRegion for SnippetState {\n    fn ranges(&self) -> &[Range<Anchor>] {\n        &self.ranges[self.active_index]\n    }","sourceCodeStart":12592,"sourceCodeEnd":12628,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/editor/src/editor.rs#L12592-L12628","documentation":"A type guard in the prompt editor's confirm handler: submitting a prompt reads the prompt entity's buffer and calls as_singleton().expect, because prompt inputs are modeled as a single buffer and a multi-buffer (excerpt list) prompt buffer would make the submitted message ambiguous. It fires only if a prompt was somehow constructed from a multi-buffer, which the API contract forbids.","triggerScenarios":"Thrown at crates/editor/src/editor.rs:12474 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Guard with if let Some(buffer) = ...as_singleton() and skip or no-op the confirm when the invariant is broken","Enforce single-buffer construction at prompt-builder time so confirm can rely on it","Replace expect with a debug_assert plus graceful degradation in release builds"],"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"}