{"record":{"id":"b8ec598f2e464885","repo":"zed-industries/zed","slug":"user-is-not-a-channel-participant-or-channel-does","errorCode":null,"errorMessage":"user is not a channel participant or channel does not exist","messagePattern":"user is not a channel participant or channel does not exist","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/collab/src/db/queries/channels.rs","lineNumber":784,"sourceCode":"                \"user is not a channel member or channel does not exist\"\n            ))?,\n        }\n    }\n\n    /// Returns whether the given user is a participant in the specified channel.\n    pub async fn check_user_is_channel_participant(\n        &self,\n        channel: &channel::Model,\n        user_id: UserId,\n        tx: &DatabaseTransaction,\n    ) -> Result<ChannelRole> {\n        let role = self.channel_role_for_user(channel, user_id, tx).await?;\n        match role {\n            Some(ChannelRole::Admin)\n            | Some(ChannelRole::Member)\n            | Some(ChannelRole::Guest)\n            | Some(ChannelRole::Talker) => Ok(role.unwrap()),\n            Some(ChannelRole::Banned) | None => Err(anyhow!(\n                \"user is not a channel participant or channel does not exist\"\n            ))?,\n        }\n    }\n\n    /// Returns a user's pending invite for the given channel, if one exists.\n    pub async fn pending_invite_for_channel(\n        &self,\n        channel: &channel::Model,\n        user_id: UserId,\n        tx: &DatabaseTransaction,\n    ) -> Result<Option<channel_member::Model>> {\n        let row = channel_member::Entity::find()\n            .filter(channel_member::Column::ChannelId.eq(channel.root_id()))\n            .filter(channel_member::Column::UserId.eq(user_id))\n            .filter(channel_member::Column::Accepted.eq(false))\n            .one(tx)\n            .await?;","sourceCodeStart":766,"sourceCodeEnd":802,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/collab/src/db/queries/channels.rs#L766-L802","documentation":"A generic authorization sentinel from check_user_is_channel_participant: the user's resolved channel role grants no participation rights (or no membership exists). It gates join/rejoin/update/get operations on channel buffers and rooms.","triggerScenarios":"Thrown at crates/collab/src/db/queries/channels.rs:784 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the user has joined the channel or has an accepted invitation","Check for Guest/Banned roles that exclude the user from participation"],"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"}