zed-industries/zed · error

cannot create worktrees via collab

Error message

cannot create worktrees via collab

What it means

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.

Source

Thrown at crates/project/src/worktree_store.rs:789

        }
    }
    pub fn create_worktree(
        &mut self,
        abs_path: impl AsRef<Path>,
        visible: bool,
        cx: &mut Context<Self>,
    ) -> Task<Result<Entity<Worktree>>> {
        let abs_path: Arc<SanitizedPath> = SanitizedPath::new_arc(&abs_path);
        let is_via_collab = matches!(&self.state, WorktreeStoreState::Remote { upstream_client, .. } if upstream_client.is_via_collab());
        if !self.loading_worktrees.contains_key(&abs_path) {
            let task = match &self.state {
                WorktreeStoreState::Remote {
                    upstream_client,
                    path_style,
                    ..
                } => {
                    if upstream_client.is_via_collab() {
                        Task::ready(Err(Arc::new(anyhow!("cannot create worktrees via collab"))))
                    } else {
                        let abs_path = RemotePathBuf::new(abs_path.to_string(), *path_style);
                        self.create_remote_worktree(upstream_client.clone(), abs_path, visible, cx)
                    }
                }
                WorktreeStoreState::Local { fs } => {
                    self.create_local_worktree(fs.clone(), abs_path.clone(), visible, cx)
                }
            };

            let loading_task = cx.spawn({
                let abs_path = abs_path.clone();
                async move |this, cx| {
                    let result = task.await;
                    this.update(cx, |this, cx| {
                        this.loading_worktrees.remove(&abs_path);
                        if !visible || !this.scanning_enabled || result.is_err() {
                            this.update_initial_scan_state(cx);

View on GitHub (pinned to f4178619ac)

Solutions

  1. Create the worktree locally instead
  2. Add the directory from the host session rather than as a guest
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/project/src/worktree_store.rs:789 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/7f41916281544227. Report an issue: GitHub.