zeroclaw-labs/zeroclaw · error · anyhow::Error
Mochat channel requires the `channel-mochat` feature
Error message
Mochat channel requires the `channel-mochat` feature
What it means
Raised by build_channel_by_id when channel_id = "mochat" is requested but the binary was compiled without the `channel-mochat` feature. The enabled arm builds the Mochat channel with peer_resolver and a poll_interval_secs from [channels.mochat]; without the feature only the bail arm exists.
Source
Thrown at crates/zeroclaw-channels/src/orchestrator/mod.rs:9602
.get("default")
.context("Mochat 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("mochat", &alias))
};
Ok(Arc::new(MochatChannel::new(
mc.api_url.clone(),
mc.api_token.clone(),
alias,
peer_resolver,
mc.poll_interval_secs,
)))
}
#[cfg(not(feature = "channel-mochat"))]
"mochat" => {
anyhow::bail!("Mochat channel requires the `channel-mochat` feature");
}
#[cfg(feature = "channel-imessage")]
"imessage" => {
if !config.channels.imessage.contains_key("default") {
anyhow::bail!("iMessage 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("imessage", &alias))
};
Ok(Arc::new(IMessageChannel::new(alias, peer_resolver)))
}
#[cfg(not(feature = "channel-imessage"))]
"imessage" => {
anyhow::bail!("iMessage channel requires the `channel-imessage` feature");
}View on GitHub (pinned to 88bb9c8533)
Solutions
- Rebuild with cargo build --release --features channel-mochat
- Or use --features channels-full
- Or remove [channels.mochat] and "mochat" bindings
- Check zeroclaw_channels::listing::is_channel_type_compiled("mochat")
Example fix
# before cargo build --release # after cargo build --release --features channel-mochat
Defensive patterns
Strategy: validation
Validate before calling
use zeroclaw_channels::listing::is_channel_type_compiled;
if !is_channel_type_compiled("mochat") {
eprintln!("rebuild with --features channel-mochat or remove [channels.mochat]");
} Type guard
fn mochat_available() -> bool {
zeroclaw_channels::listing::is_channel_type_compiled("mochat")
} Try / catch
match build_channel_by_id(&config_arc, "mochat") {
Ok(ch) => { /* use */ }
Err(e) if e.to_string().contains("requires the `channel-mochat` feature") => {
// skip; rebuild hint
}
Err(e) => return Err(e),
} Prevention
- Mochat is cfg-gated only; adding it to a build is zero-dep cost, so consider channels-full for WeChat-adjacent stacks
- Lint config channel ids against the compiled listing on deploy
When it happens
Trigger: start_channels / build_channel_by_id selecting "mochat" from an [channels.mochat] block or agent binding in a build lacking --features channel-mochat.
Common situations: Default-feature builds (mochat is in channels-full only); WeChat-adjacent stacks where Mochat was configured but the binary was compiled from a curated feature list; configs synced between full and slim deployments.
Related errors
- QQ channel requires the `channel-qq` feature
- Lark channel requires the `channel-lark` feature
- DingTalk channel requires the `channel-dingtalk` feature
- WeCom channel requires the `channel-wecom` feature
- WeCom WebSocket channel requires the `channel-wecom-ws` feat
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/c4b22a25238ea9a3.
Report an issue: GitHub.