{"record":{"id":"8b5cfa42a0f1ef5d","repo":"zed-industries/zed","slug":"cannot-unshare-a-project-hosted-by-another-user","errorCode":null,"errorMessage":"cannot unshare a project hosted by another user","messagePattern":"cannot unshare a project hosted by another user","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/collab/src/db/queries/projects.rs","lineNumber":151,"sourceCode":"        &self,\n        project_id: ProjectId,\n        connection: ConnectionId,\n    ) -> Result<TransactionGuard<(bool, Option<proto::Room>, Vec<ConnectionId>)>> {\n        self.project_transaction(project_id, |tx| async move {\n            let guest_connection_ids = self.project_guest_connection_ids(project_id, &tx).await?;\n            let project = project::Entity::find_by_id(project_id)\n                .one(&*tx)\n                .await?\n                .context(\"project not found\")?;\n            let room = if let Some(room_id) = project.room_id {\n                Some(self.get_room(room_id, &tx).await?)\n            } else {\n                None\n            };\n            if project.host_connection()? == connection {\n                return Ok((true, room, guest_connection_ids));\n            }\n            Err(anyhow!(\"cannot unshare a project hosted by another user\"))?\n        })\n        .await\n    }\n\n    /// Updates the worktrees associated with the given project.\n    pub async fn update_project(\n        &self,\n        project_id: ProjectId,\n        connection: ConnectionId,\n        worktrees: &[proto::WorktreeMetadata],\n    ) -> Result<TransactionGuard<(Option<proto::Room>, Vec<ConnectionId>)>> {\n        self.project_transaction(project_id, |tx| async move {\n            let project = project::Entity::find_by_id(project_id)\n                .filter(\n                    Condition::all()\n                        .add(project::Column::HostConnectionId.eq(connection.id as i32))\n                        .add(\n                            project::Column::HostConnectionServerId.eq(connection.owner_id as i32),","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/collab/src/db/queries/projects.rs#L133-L169","documentation":"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.","triggerScenarios":"Thrown at crates/collab/src/db/queries/projects.rs:151 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Have the hosting user issue the unshare request","Verify the correct project_id is being unshared from the expected connection"],"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-23T08:17:48.524Z"}