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

can't update a project hosted by someone else

Error message

can't update a project hosted by someone else

What it means

update_diagnostic_summary loads the project and asserts its host connection matches the sender, ensuring diagnostic updates come from the host. This error means the calling connection is not the host of the project it tried to update.

Solutions

  1. Send diagnostic summaries only from the host connection of the project
  2. Verify the project_id belongs to a project this connection hosts
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    /// Updates the diagnostic summary for the given connection.
    pub async fn update_diagnostic_summary(
        &self,
        update: &proto::UpdateDiagnosticSummary,
        connection: ConnectionId,
    ) -> Result<TransactionGuard<Vec<ConnectionId>>> {
        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 {
            let summary = update.summary.as_ref().context("invalid summary")?;

            // Ensure the update comes from the host.
            let project = project::Entity::find_by_id(project_id)
                .one(&*tx)
                .await?
                .context("no such project")?;
            if project.host_connection()? != connection {
                return Err(anyhow!("can't update a project hosted by someone else"))?;
            }

            // Update summary.
            worktree_diagnostic_summary::Entity::insert(worktree_diagnostic_summary::ActiveModel {
                project_id: ActiveValue::set(project_id),
                worktree_id: ActiveValue::set(worktree_id),
                path: ActiveValue::set(summary.path.clone()),
                language_server_id: ActiveValue::set(summary.language_server_id as i64),
                error_count: ActiveValue::set(summary.error_count as i32),
                warning_count: ActiveValue::set(summary.warning_count as i32),
            })
            .on_conflict(
                OnConflict::columns([
                    worktree_diagnostic_summary::Column::ProjectId,
                    worktree_diagnostic_summary::Column::WorktreeId,
                    worktree_diagnostic_summary::Column::Path,
                ])
                .update_columns([

View on GitHub (pinned to f4178619ac)