{"record":{"id":"ac0a04f415439442","repo":"zed-industries/zed","slug":"cannot-call-save-as-on-an-excerpt-list","errorCode":null,"errorMessage":"cannot call save_as on an excerpt list","messagePattern":"cannot call save_as on an excerpt list","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/editor/src/items.rs","lineNumber":1034,"sourceCode":"\n            if !buffers_to_save.is_empty() {\n                project\n                    .update(cx, |project, cx| {\n                        project.save_buffers(buffers_to_save.clone(), cx)\n                    })\n                    .await?;\n            }\n\n            Ok(())\n        })\n    }\n\n    fn save_as(\n        &mut self,\n        project: Entity<Project>,\n        path: ProjectPath,\n        _: &mut Window,\n        cx: &mut Context<Self>,\n    ) -> Task<Result<()>> {\n        let buffer = self\n            .buffer()\n            .read(cx)\n            .as_singleton()\n            .expect(\"cannot call save_as on an excerpt list\");\n\n        let file_extension = path.path.extension().map(|a| a.to_string());\n        self.report_editor_event(\n            ReportEditorEvent::Saved { auto_saved: false },\n            file_extension,\n            cx,\n        );\n\n        project.update(cx, |project, cx| project.save_buffer_as(buffer, path, cx))\n    }\n\n    fn reload(","sourceCodeStart":1016,"sourceCodeEnd":1052,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/editor/src/items.rs#L1016-L1052","documentation":"A type guard on BufferItemHandle::save_as: saving under a new path writes a single file, so it calls as_singleton().expect and panics when the editor's buffer is a multi-buffer/excerpt list, for which 'save as one file' is undefined. It fires when a caller routes a save_as through an editor that holds excerpts from multiple files instead of a singleton buffer.","triggerScenarios":"Thrown at crates/editor/src/items.rs:1026 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check as_singleton() and return a Task resolving to an error (or bail with 'cannot save an excerpt list as a single file') instead of panicking","Route multi-buffer saves through the multi-buffer save API or disallow the action for excerpt lists","Disable the Save As action in the UI when the active editor is not a singleton buffer"],"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-14T00:17:10.932Z"}