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

WeChat channel requires the `channel-wechat` feature

Error message

WeChat channel requires the `channel-wechat` feature

What it means

Raised by build_channel_by_id when channel_id = "wechat" is requested but the binary lacks the `channel-wechat` Cargo feature. Notably, `channel-wechat` is NOT part of the `channels-full` bundle in crates/zeroclaw-channels/Cargo.toml — it must be enabled by name. It also carries real optional deps (aes, ecb, md5, mime_guess, qrcode), which is why it is kept out of the bundle.

Source

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

                let alias = alias.clone();
                Arc::new(move || cfg_arc.read().channel_external_peers("wechat", &alias))
            };
            let workspace_dir = one_shot_channel_workspace_dir(&config, "wechat", &alias);
            Ok(Arc::new(
                WeChatChannel::new(
                    alias,
                    peer_resolver,
                    wc.api_base_url.clone(),
                    wc.cdn_base_url.clone(),
                    Some(WeChatChannel::resolve_state_dir(wc.state_dir.as_deref())),
                )?
                .with_persistence(config_arc.clone())
                .with_workspace_dir(workspace_dir),
            ))
        }
        #[cfg(not(feature = "channel-wechat"))]
        "wechat" => {
            anyhow::bail!("WeChat channel requires the `channel-wechat` feature");
        }
        #[cfg(feature = "channel-nextcloud")]
        "nextcloud_talk" | "nextcloud-talk" => {
            let nc = config
                .channels
                .nextcloud_talk
                .get("default")
                .context("Nextcloud Talk 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("nextcloud_talk", &alias)
                })
            };

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Rebuild with the feature by name: cargo build --release --features channel-wechat (channels-full does NOT include it)
  2. Double-check the feature list actually passed to the binary crate you run, not just to zeroclaw-channels
  3. Or remove [channels.wechat] and "wechat" agent bindings from the config
  4. Verify with zeroclaw_channels::listing::is_channel_type_compiled("wechat")

Example fix

# before
 cargo build --release --features channels-full   # still no wechat

 # after
 cargo build --release --features "channels-full,channel-wechat"
Defensive patterns

Strategy: validation

Validate before calling

use zeroclaw_channels::listing::is_channel_type_compiled;

if !is_channel_type_compiled("wechat") {
    eprintln!("channel-wechat is NOT in channels-full; rebuild with --features channel-wechat");
}

Type guard

fn wechat_available() -> bool {
    zeroclaw_channels::listing::is_channel_type_compiled("wechat")
}

Try / catch

match build_channel_by_id(&config_arc, "wechat") {
    Ok(ch) => { /* use */ }
    Err(e) if e.to_string().contains("requires the `channel-wechat` feature") => {
        // skip; note that channels-full does not fix this one
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: start_channels / build_channel_by_id selecting "wechat" (from [channels.wechat] or an agent binding) in any build that did not pass --features channel-wechat explicitly — including --features channels-full builds.

Common situations: Operators enabling channels-full and assuming it means every channel; WeChat support requires the named feature. Also default builds, and prebuilt binaries where WeChat was excluded deliberately (QR-login flow in login_relink.rs is also wechat-gated).

Related errors


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