zed-industries/zed · error · anyhow::Error

user is not a channel member or channel does not exist

Error message

user is not a channel member or channel does not exist

What it means

A generic authorization sentinel from check_user_is_channel_member: the user's role is not Admin or Member (e.g. Talker, Guest, or Banned), or they have no membership in the channel. Used by update_channel_buffer to gate buffer edits to full members.

Solutions

  1. Have the user join the channel or be invited as a full member
  2. Check whether the user's role is Guest/Talker/Banned, which do not count as members for this operation
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/collab/src/db/queries/channels.rs:765 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/5d81654bab1b0945. Report an issue: GitHub.

Appendix: source

Thrown at crates/collab/src/db/queries/channels.rs:765

                "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)
            | None => Err(anyhow!(
                "user is not a channel member or channel does not exist"
            ))?,
        }
    }

    /// Returns whether the given user is a participant in the specified channel.
    pub async fn check_user_is_channel_participant(
        &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)
            | Some(ChannelRole::Member)
            | Some(ChannelRole::Guest)
            | Some(ChannelRole::Talker) => Ok(role.unwrap()),

View on GitHub (pinned to f4178619ac)