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

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

Thrown by check_user_is_channel_member (crates/collab/src/db/queries/channels.rs:765): the user's role is Banned, Guest, Talker, or None. Only Admin and Member count as full members; Talker/Guest are read-oriented roles and Banned users are excluded entirely.

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 bc538def45)

Solutions

  1. Have an admin upgrade the user's role to Member or Admin for that channel
  2. Unban the user first if the role is Banned — unbanning must precede any member action
  3. On the client, gate member-only actions on the precise role value, not on mere channel visibility
Defensive patterns

Strategy: validation

Validate before calling

fn is_full_member(role: Option<ChannelRole>) -> bool {
    matches!(role, Some(ChannelRole::Admin) | Some(ChannelRole::Member))
}

Type guard

fn is_channel_member(role: Option<ChannelRole>) -> bool {
    matches!(role, Some(ChannelRole::Admin) | Some(ChannelRole::Member))
}

Prevention

When it happens

Trigger: A Talker or Guest (e.g. a public-channel participant without membership) invoking member-gated operations; a banned user attempting any member action; a user with no channel_member row (None).

Common situations: Users who joined a public channel's call as guests assuming they became members; after a ban takes effect but the client session predates it; role changed to Talker to revoke write access, then member-only RPCs start failing.

Related errors


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/5d81654bab1b0945. Report an issue: GitHub.