{"record":{"id":"1457eec67c152a04","repo":"zed-industries/zed","slug":"not-authorized-to-edit-projects","errorCode":null,"errorMessage":"not authorized to edit projects","messagePattern":"not authorized to edit projects","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/collab/src/db/queries/projects.rs","lineNumber":1137,"sourceCode":"            .context(\"no such project\")?;\n\n        let role_from_room = if let Some(room_id) = project.room_id {\n            room_participant::Entity::find()\n                .filter(room_participant::Column::RoomId.eq(room_id))\n                .filter(room_participant::Column::AnsweringConnectionId.eq(connection_id.id))\n                .one(tx)\n                .await?\n                .and_then(|participant| participant.role)\n        } else {\n            None\n        };\n\n        let role = role_from_room.unwrap_or(ChannelRole::Banned);\n\n        match capability {\n            Capability::ReadWrite => {\n                if !role.can_edit_projects() {\n                    return Err(anyhow!(\"not authorized to edit projects\"))?;\n                }\n            }\n            Capability::ReadOnly => {\n                if !role.can_read_projects() {\n                    return Err(anyhow!(\"not authorized to read projects\"))?;\n                }\n            }\n        }\n\n        Ok((project, role))\n    }\n\n    /// Returns the host connection for a read-only request to join a shared project.\n    pub async fn host_for_read_only_project_request(\n        &self,\n        project_id: ProjectId,\n        connection_id: ConnectionId,\n    ) -> Result<ConnectionId> {","sourceCodeStart":1119,"sourceCodeEnd":1155,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/collab/src/db/queries/projects.rs#L1119-L1155","documentation":"access_project resolves the caller's role from their room participation (defaulting to Banned when absent) and matches it against the requested Capability; for ReadWrite it requires a role where can_edit_projects() holds. This sentinel means the caller's role lacks edit authorization for the project.","triggerScenarios":"Thrown at crates/collab/src/db/queries/projects.rs:1137 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Have the caller join the project's room with an role that permits editing","Request read-only access instead if the role cannot be elevated"],"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"}