zeroclaw-labs/zeroclaw · error · anyhow::Error

Mattermost channel requires the `channel-mattermost` feature

Error message

Mattermost channel requires the `channel-mattermost` feature

What it means

Thrown by build_channel_by_id when channel_type is `mattermost` and the crate was compiled without the `channel-mattermost` cargo feature. The mattermost construction arm is feature-gated; the fallback arm reports the missing feature. It is purely a compile-time capability gap, independent of any runtime configuration.

Source

Thrown at crates/zeroclaw-channels/src/orchestrator/mod.rs:9055

                MattermostChannel::new(
                    mm.url.clone(),
                    mm.bot_token.clone(),
                    mm.login_id.clone(),
                    mm.password.clone(),
                    mm.channel_ids.clone(),
                    alias,
                    peer_resolver,
                    mm.thread_replies.unwrap_or(true),
                    mm.mention_only.unwrap_or(false),
                )
                .with_team_ids(mm.team_ids.clone())
                .with_discover_dms(mm.discover_dms.unwrap_or(true))
                .with_listen_mode(mm.listen_mode),
            ))
        }
        #[cfg(not(feature = "channel-mattermost"))]
        "mattermost" => {
            anyhow::bail!("Mattermost channel requires the `channel-mattermost` feature");
        }
        #[cfg(feature = "channel-signal")]
        "signal" => {
            let sg = config
                .channels
                .signal
                .get("default")
                .context("Signal channel is not configured")?;
            let alias = "default".to_string();
            let peer_resolver: Arc<dyn Fn() -> Vec<String> + Send + Sync> = {
                let cfg_arc = config_arc.clone();
                let alias = alias.clone();
                Arc::new(move || cfg_arc.read().channel_external_peers("signal", &alias))
            };
            Ok(Arc::new(
                SignalChannel::new(
                    sg.http_url.clone(),
                    sg.account.clone(),

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Rebuild with `cargo build --features channel-mattermost`
  2. Use a build that bundles mattermost support
  3. Or disable/remove `[channels.mattermost]` sections

Example fix

# before
cargo build --no-default-features
# error: Mattermost channel requires the `channel-mattermost` feature

# after
cargo build --no-default-features --features channel-mattermost
Defensive patterns

Strategy: validation

Validate before calling

#[cfg(not(feature = "channel-mattermost"))]
if !config.channels.mattermost.is_empty() {
    log::warn!("[channels.mattermost.*] configured but `channel-mattermost` feature is off");
}

Type guard

fn channel_feature_enabled(channel_type: &str) -> bool {
    match channel_type {
        "mattermost" => cfg!(feature = "channel-mattermost"),
        "telegram" => cfg!(feature = "channel-telegram"),
        "discord" => cfg!(feature = "channel-discord"),
        "slack" => cfg!(feature = "channel-slack"),
        "signal" => cfg!(feature = "channel-signal"),
        "matrix" => cfg!(feature = "channel-matrix"),
        "whatsapp" | "whatsapp-web" => cfg!(feature = "whatsapp-web"),
        _ => false,
    }
}

Try / catch

Err(err) if err.to_string().contains("requires the `channel-mattermost` feature") => {
    // rebuild with the feature or drop mattermost from config
}

Prevention

When it happens

Trigger: A `[channels.mattermost.*]` section or `mattermost.<alias>` send target on a binary built without `channel-mattermost`; reached from daemon startup or the one-shot send path.

Common situations: Feature-minimal deployments; upgrade replaced a full-featured binary with a slim one while config kept mattermost channels enabled.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/8b8f05cd68bf9511. Report an issue: GitHub.