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

Email channel requires the `channel-email` feature

Error message

Email channel requires the `channel-email` feature

What it means

Raised by build_channel_by_id when channel_id = "email" is requested and the binary was compiled without the `channel-email` feature. Unlike most channels here, channel-email is part of `default-channels` (and therefore of the default build), so hitting this bail almost always means the binary was built with --no-default-features or an explicitly reduced feature list. The feature pulls async-imap, lettre, and mail-parser.

Source

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

                .channels
                .email
                .get("default")
                .context("Email 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("email", &alias))
            };
            Ok(Arc::new(EmailChannel::new(
                em.clone(),
                alias,
                peer_resolver,
            )))
        }
        #[cfg(not(feature = "channel-email"))]
        "email" => {
            anyhow::bail!("Email channel requires the `channel-email` feature");
        }
        #[cfg(feature = "channel-email")]
        "gmail_push" | "gmail-push" => {
            let gp = config
                .channels
                .gmail_push
                .get("default")
                .context("Gmail Push 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("gmail_push", &alias))
            };
            Ok(Arc::new(GmailPushChannel::new(
                gp.clone(),
                alias,
                peer_resolver,

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Rebuild without --no-default-features, or re-add the feature: cargo build --release --features channel-email
  2. Audit any default-features = false in your Cargo.toml override for the zeroclaw binary
  3. Or remove [channels.email] and "email" bindings from config
  4. Pre-check zeroclaw_channels::listing::is_channel_type_compiled("email")

Example fix

# before
 cargo build --release --no-default-features --features channel-telegram

 # after
 cargo build --release --no-default-features --features "channel-telegram,channel-email"
Defensive patterns

Strategy: validation

Validate before calling

use zeroclaw_channels::listing::is_channel_type_compiled;

if !is_channel_type_compiled("email") {
    // email is a DEFAULT channel; being missing implies --no-default-features
    eprintln!("binary built without default features; rebuild with --features channel-email");
}

Type guard

fn email_available() -> bool {
    zeroclaw_channels::listing::is_channel_type_compiled("email")
}

Try / catch

match build_channel_by_id(&config_arc, "email") {
    Ok(ch) => { /* use */ }
    Err(e) if e.to_string().contains("requires the `channel-email` feature") => {
        // unusual: default build has email; audit feature flags in the build
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: start_channels / build_channel_by_id selecting "email" from an [channels.email] block while the crate was compiled with --no-default-features (or default-features = false without re-adding channel-email).

Common situations: Minimal/embedded builds that disable default features to cut dependencies; feature lists authored for a la carte setup that forgot email; CI matrix builds testing reduced feature sets then deployed with a full config.

Related errors


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