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

channel name can't be blank

Error message

channel name can't be blank

What it means

sanitize_channel_name trims whitespace and strips leading '#' characters; if nothing remains, the proposed channel name is effectively empty and rejected. This is a user-input validation guard used by channel creation and renaming.

Solutions

  1. Enter a channel name containing at least one non-whitespace character besides '#'
  2. Strip fewer characters, e.g. avoid a name made only of '#' symbols
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

                    true,
                    &tx,
                )
                .await?
                .into_iter()
                .collect();

            Ok(InviteMemberResult {
                channel,
                notifications,
            })
        })
        .await
    }

    fn sanitize_channel_name(name: &str) -> Result<&str> {
        let new_name = name.trim().trim_start_matches('#');
        if new_name.is_empty() {
            Err(anyhow!("channel name can't be blank"))?;
        }
        Ok(new_name)
    }

    /// Renames the specified channel.
    pub async fn rename_channel(
        &self,
        channel_id: ChannelId,
        admin_id: UserId,
        new_name: &str,
    ) -> Result<channel::Model> {
        self.transaction(move |tx| async move {
            let new_name = Self::sanitize_channel_name(new_name)?.to_string();

            let channel = self.get_channel_internal(channel_id, &tx).await?;
            self.check_user_is_channel_admin(&channel, admin_id, &tx)
                .await?;

View on GitHub (pinned to f4178619ac)