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

Slack channel requires the `channel-slack` feature

Error message

Slack channel requires the `channel-slack` feature

What it means

Thrown by build_channel_by_id when channel_type is `slack` and the `channel-slack` cargo feature was not compiled in. Like the other channel gates, the Slack arm is behind #[cfg(feature = "channel-slack")]; the not-feature arm bails with the feature name. Nothing about runtime config can fix it — the code is absent from the binary.

Source

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

                SlackChannel::new(
                    bot_token,
                    sl.resolved_app_token(),
                    sl.channel_ids.clone(),
                    alias,
                    peer_resolver,
                )
                .with_thread_context_max_messages_resolver(thread_context_max_messages_resolver)
                .with_workspace_dir(workspace_dir)
                .with_markdown_blocks(sl.use_markdown_blocks)
                .with_transcription(config.transcription.clone())
                .with_streaming(sl.stream_drafts, sl.draft_update_interval_ms)
                .with_cancel_reaction(sl.cancel_reaction.clone())
                .with_approval_timeout_secs(sl.approval_timeout_secs),
            ))
        }
        #[cfg(not(feature = "channel-slack"))]
        "slack" => {
            anyhow::bail!("Slack channel requires the `channel-slack` feature");
        }
        #[cfg(feature = "channel-mattermost")]
        "mattermost" => {
            let mm = config
                .channels
                .mattermost
                .get("default")
                .context("Mattermost 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("mattermost", &alias))
            };
            Ok(Arc::new(
                MattermostChannel::new(
                    mm.url.clone(),
                    mm.bot_token.clone(),

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Rebuild with `cargo build --features channel-slack`
  2. Select a prebuilt image/package that includes slack
  3. Or remove the slack channel sections from config

Example fix

# before
cargo build --no-default-features
# error: Slack channel requires the `channel-slack` feature

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

Strategy: validation

Validate before calling

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

Type guard

fn channel_feature_enabled(channel_type: &str) -> bool {
    match channel_type {
        "slack" => cfg!(feature = "channel-slack"),
        "telegram" => cfg!(feature = "channel-telegram"),
        "discord" => cfg!(feature = "channel-discord"),
        "mattermost" => cfg!(feature = "channel-mattermost"),
        "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-slack` feature") => {
    // rebuild with --features channel-slack or remove slack sections from config
}

Prevention

When it happens

Trigger: Config has `[channels.slack.*]` or a delivery target `slack.<alias>` while the binary omits `channel-slack`. Hit during daemon startup channel construction and one-shot sends through build_channel_by_id.

Common situations: Slim build variants; feature list trimmed in CI; moving a config between environments whose binaries have different feature sets.

Related errors


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