{"record":{"id":"0857ee8cc5c96573","repo":"zed-industries/zed","slug":"shared-project-on-unexpected-room","errorCode":null,"errorMessage":"shared project on unexpected room","messagePattern":"shared project on unexpected room","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/collab/src/db/queries/projects.rs","lineNumber":56,"sourceCode":"    ) -> Result<TransactionGuard<(ProjectId, proto::Room)>> {\n        self.room_transaction(room_id, |tx| async move {\n            let participant = room_participant::Entity::find()\n                .filter(\n                    Condition::all()\n                        .add(\n                            room_participant::Column::AnsweringConnectionId\n                                .eq(connection.id as i32),\n                        )\n                        .add(\n                            room_participant::Column::AnsweringConnectionServerId\n                                .eq(connection.owner_id as i32),\n                        ),\n                )\n                .one(&*tx)\n                .await?\n                .context(\"could not find participant\")?;\n            if participant.room_id != room_id {\n                return Err(anyhow!(\"shared project on unexpected room\"))?;\n            }\n            if !participant\n                .role\n                .unwrap_or(ChannelRole::Member)\n                .can_edit_projects()\n            {\n                return Err(anyhow!(\"guests cannot share projects\"))?;\n            }\n\n            let project = project::ActiveModel {\n                room_id: ActiveValue::set(Some(participant.room_id)),\n                host_user_id: ActiveValue::set(Some(participant.user_id)),\n                host_connection_id: ActiveValue::set(Some(connection.id as i32)),\n                host_connection_server_id: ActiveValue::set(Some(ServerId(\n                    connection.owner_id as i32,\n                ))),\n                id: ActiveValue::NotSet,\n                windows_paths: ActiveValue::set(windows_paths),","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/collab/src/db/queries/projects.rs#L38-L74","documentation":"share_project looks up the room participant row for the calling connection and asserts its room_id equals the room being shared on; a mismatch means the connection is participating in a different room than the one named in the request — an inconsistent or malicious request, not a user error.","triggerScenarios":"Thrown at crates/collab/src/db/queries/projects.rs:56 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the share request targets the room the connection actually joined","Rejoin the intended room and retry sharing"],"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-14T00:17:10.932Z"}