{"record":{"id":"7f41916281544227","repo":"zed-industries/zed","slug":"cannot-create-worktrees-via-collab","errorCode":null,"errorMessage":"cannot create worktrees via collab","messagePattern":"cannot create worktrees via collab","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/project/src/worktree_store.rs","lineNumber":789,"sourceCode":"        }\n    }\n    pub fn create_worktree(\n        &mut self,\n        abs_path: impl AsRef<Path>,\n        visible: bool,\n        cx: &mut Context<Self>,\n    ) -> Task<Result<Entity<Worktree>>> {\n        let abs_path: Arc<SanitizedPath> = SanitizedPath::new_arc(&abs_path);\n        let is_via_collab = matches!(&self.state, WorktreeStoreState::Remote { upstream_client, .. } if upstream_client.is_via_collab());\n        if !self.loading_worktrees.contains_key(&abs_path) {\n            let task = match &self.state {\n                WorktreeStoreState::Remote {\n                    upstream_client,\n                    path_style,\n                    ..\n                } => {\n                    if upstream_client.is_via_collab() {\n                        Task::ready(Err(Arc::new(anyhow!(\"cannot create worktrees via collab\"))))\n                    } else {\n                        let abs_path = RemotePathBuf::new(abs_path.to_string(), *path_style);\n                        self.create_remote_worktree(upstream_client.clone(), abs_path, visible, cx)\n                    }\n                }\n                WorktreeStoreState::Local { fs } => {\n                    self.create_local_worktree(fs.clone(), abs_path.clone(), visible, cx)\n                }\n            };\n\n            let loading_task = cx.spawn({\n                let abs_path = abs_path.clone();\n                async move |this, cx| {\n                    let result = task.await;\n                    this.update(cx, |this, cx| {\n                        this.loading_worktrees.remove(&abs_path);\n                        if !visible || !this.scanning_enabled || result.is_err() {\n                            this.update_initial_scan_state(cx);","sourceCodeStart":771,"sourceCodeEnd":807,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/project/src/worktree_store.rs#L771-L807","documentation":"In WorktreeStore::create_worktree: the store is in the Remote state with a via-collab upstream client, i.e. a guest session. Creating worktrees is host-only, so the request is rejected before any filesystem work.","triggerScenarios":"Thrown at crates/project/src/worktree_store.rs:789 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the worktree locally instead","Add the directory from the host session rather than as a guest"],"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"}