zed-industries/zed · error · anyhow::Error

invalid worktree update. removed entries: {}, updated entrie

Error message

invalid worktree update. removed entries: {}, updated entries: {}

What it means

update_worktree rejects proto::UpdateWorktree payloads whose removed_entries or updated_entries exceed proto::MAX_WORKTREE_UPDATE_MAX_CHUNK_SIZE. It is a protocol-level chunk-size guard; the counts in the message show which side of the update was oversized.

Source

Thrown at crates/collab/src/db/queries/projects.rs:236

        worktree::Entity::delete_many()
            .filter(worktree::Column::ProjectId.eq(project_id).and(
                worktree::Column::Id.is_not_in(worktrees.iter().map(|worktree| worktree.id as i64)),
            ))
            .exec(tx)
            .await?;

        Ok(())
    }

    pub async fn update_worktree(
        &self,
        update: &proto::UpdateWorktree,
        connection: ConnectionId,
    ) -> Result<TransactionGuard<Vec<ConnectionId>>> {
        if update.removed_entries.len() > proto::MAX_WORKTREE_UPDATE_MAX_CHUNK_SIZE
            || update.updated_entries.len() > proto::MAX_WORKTREE_UPDATE_MAX_CHUNK_SIZE
        {
            return Err(anyhow!(
                "invalid worktree update. removed entries: {}, updated entries: {}",
                update.removed_entries.len(),
                update.updated_entries.len()
            ))?;
        }

        let project_id = ProjectId::from_proto(update.project_id);
        let worktree_id = update.worktree_id as i64;
        self.project_transaction(project_id, |tx| async move {
            // Ensure the update comes from the host.
            let _project = project::Entity::find_by_id(project_id)
                .filter(
                    Condition::all()
                        .add(project::Column::HostConnectionId.eq(connection.id as i32))
                        .add(
                            project::Column::HostConnectionServerId.eq(connection.owner_id as i32),
                        ),
                )

View on GitHub (pinned to f4178619ac)

Solutions

  1. Split the worktree update into smaller chunks within the protocol limit
  2. Update both peers to versions agreeing on the chunk size limit
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/collab/src/db/queries/projects.rs:236 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/f8ba43f495d81430. Report an issue: GitHub.