{"record":{"id":"8eb8609089fdcea6","repo":"zed-industries/zed","slug":"delete-sessions-not-supported","errorCode":null,"errorMessage":"delete_sessions not supported","messagePattern":"delete_sessions not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/acp_thread/src/connection.rs","lineNumber":403,"sourceCode":"}\n\npub trait AgentSessionList {\n    fn list_sessions(\n        &self,\n        request: AgentSessionListRequest,\n        cx: &mut App,\n    ) -> Task<Result<AgentSessionListResponse>>;\n\n    fn supports_delete(&self) -> bool {\n        false\n    }\n\n    fn delete_session(&self, _session_id: &acp::SessionId, _cx: &mut App) -> Task<Result<()>> {\n        Task::ready(Err(anyhow::anyhow!(\"delete_session not supported\")))\n    }\n\n    fn delete_sessions(&self, _cx: &mut App) -> Task<Result<()>> {\n        Task::ready(Err(anyhow::anyhow!(\"delete_sessions not supported\")))\n    }\n\n    fn watch(&self, _cx: &mut App) -> Option<async_channel::Receiver<SessionListUpdate>> {\n        None\n    }\n\n    fn notify_refresh(&self) {}\n\n    fn into_any(self: Rc<Self>) -> Rc<dyn Any>;\n}\n\nimpl dyn AgentSessionList {\n    pub fn downcast<T: 'static + AgentSessionList + Sized>(self: Rc<Self>) -> Option<Rc<T>> {\n        self.into_any().downcast().ok()\n    }\n}\n\n#[derive(Debug)]","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/acp_thread/src/connection.rs#L385-L421","documentation":"Default implementation of AgentSessionList::delete_sessions (the clear-all variant). Backends that only implement single-session deletion, or neither, return this error when asked to delete every session.","triggerScenarios":"Calling delete_sessions on an AgentSessionList impl that did not override the bulk method; a 'clear all history' action routed to a backend without bulk support.","commonSituations":"History-management UI assuming bulk delete exists; custom backends implementing delete_session but not delete_sessions.","solutions":["Gate bulk-delete calls on supports_delete() and fall back to iterating delete_session per id when the bulk method is unsupported.","Override delete_sessions in your implementation if the backend can clear sessions efficiently.","Disable 'delete all' UI when the capability is absent."],"exampleFix":"// before\nlist.delete_sessions(cx).await?; // \"delete_sessions not supported\"\n\n// after\nif list.supports_delete() {\n    match list.delete_sessions(cx).await {\n        Err(e) if e.to_string().contains(\"not supported\") => {\n            for id in known_ids { list.delete_session(&id, cx).await?; }\n        }\n        result => result?,\n    }\n}","handlingStrategy":"validation","validationCode":"if session_list.supports_delete() {\n    // prefer bulk, fall back to per-id deletes\n    let bulk = session_list.delete_sessions(cx).await;\n    if bulk.is_err() {\n        for id in ids { session_list.delete_session(&id, cx).await?; }\n    }\n}","typeGuard":"fn can_delete_sessions(list: &Rc<dyn AgentSessionList>) -> bool {\n    list.supports_delete()\n}","tryCatchPattern":null,"preventionTips":["Check supports_delete() before offering 'clear all history'.","Implement delete_sessions in backends that can clear history efficiently."],"tags":["rust","zed","acp","trait-default","session-list","capability"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}