zed-industries/zed · error · anyhow::Error
cannot unshare a project hosted by another user
Error message
cannot unshare a project hosted by another user
What it means
unshare_project verifies the calling connection is the project's host before unsharing; this error fires when the connection attempting to unshare is not the one hosting the project. Only the original host can unshare it.
Solutions
- Have the hosting user issue the unshare request
- Verify the correct project_id is being unshared from the expected connection
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/collab/src/db/queries/projects.rs:151 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/8b5cfa42a0f1ef5d.
Report an issue: GitHub.
Appendix: source
Thrown at crates/collab/src/db/queries/projects.rs:151
&self,
project_id: ProjectId,
connection: ConnectionId,
) -> Result<TransactionGuard<(bool, Option<proto::Room>, Vec<ConnectionId>)>> {
self.project_transaction(project_id, |tx| async move {
let guest_connection_ids = self.project_guest_connection_ids(project_id, &tx).await?;
let project = project::Entity::find_by_id(project_id)
.one(&*tx)
.await?
.context("project not found")?;
let room = if let Some(room_id) = project.room_id {
Some(self.get_room(room_id, &tx).await?)
} else {
None
};
if project.host_connection()? == connection {
return Ok((true, room, guest_connection_ids));
}
Err(anyhow!("cannot unshare a project hosted by another user"))?
})
.await
}
/// Updates the worktrees associated with the given project.
pub async fn update_project(
&self,
project_id: ProjectId,
connection: ConnectionId,
worktrees: &[proto::WorktreeMetadata],
) -> Result<TransactionGuard<(Option<proto::Room>, Vec<ConnectionId>)>> {
self.project_transaction(project_id, |tx| async move {
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)