zed-industries/zed · error · anyhow::Error
user is not a channel admin or channel does not exist
Error message
user is not a channel admin or channel does not exist
What it means
A generic authorization sentinel from check_user_is_channel_admin: the user's resolved role in the channel is not Admin (or they have no membership/the channel does not exist), and the caller requires admin rights. The error deliberately does not distinguish 'not admin' from 'not a member' to avoid leaking channel existence.
Solutions
- Confirm the acting user actually holds the admin role in that channel
- Have an existing admin promote the user before retrying admin-only operations
- Check that the channel ID is correct if membership is expected
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/collab/src/db/queries/channels.rs:746 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/f7de1fdcd921e473.
Report an issue: GitHub.
Appendix: source
Thrown at crates/collab/src/db/queries/channels.rs:746
})
.await
}
/// Returns whether the given user is an admin in the specified channel.
pub async fn check_user_is_channel_admin(
&self,
channel: &channel::Model,
user_id: UserId,
tx: &DatabaseTransaction,
) -> Result<ChannelRole> {
let role = self.channel_role_for_user(channel, user_id, tx).await?;
match role {
Some(ChannelRole::Admin) => Ok(role.unwrap()),
Some(ChannelRole::Member)
| Some(ChannelRole::Talker)
| Some(ChannelRole::Banned)
| Some(ChannelRole::Guest)
| None => Err(anyhow!(
"user is not a channel admin or channel does not exist"
))?,
}
}
/// Returns whether the given user is a member of the specified channel.
pub async fn check_user_is_channel_member(
&self,
channel: &channel::Model,
user_id: UserId,
tx: &DatabaseTransaction,
) -> Result<ChannelRole> {
let channel_role = self.channel_role_for_user(channel, user_id, tx).await?;
match channel_role {
Some(ChannelRole::Admin) | Some(ChannelRole::Member) => Ok(channel_role.unwrap()),
Some(ChannelRole::Banned)
| Some(ChannelRole::Guest)
| Some(ChannelRole::Talker)View on GitHub (pinned to f4178619ac)