zeroclaw-labs/zeroclaw · error · anyhow::Error
Discord channel requires the `channel-discord` feature
Error message
Discord channel requires the `channel-discord` feature
What it means
Thrown by build_channel_by_id when channel_type is `discord` and the crate lacks the `channel-discord` cargo feature. The discord match arm only exists under that feature; without it, the fallback arm bails because the Discord runtime code was compiled out. Identical in shape to the other channel feature gates (telegram, slack, mattermost, signal, matrix, whatsapp-web).
Source
Thrown at crates/zeroclaw-channels/src/orchestrator/mod.rs:8977
dc.mention_only,
)
.with_channel_ids(dc.channel_ids.clone())
.with_workspace_dir(workspace_dir)
.with_streaming(
dc.stream_mode,
dc.draft_update_interval_ms,
dc.multi_message_delay_ms,
)
.with_transcription(config.transcription.clone())
.with_stall_timeout(dc.stall_timeout_secs)
.with_approval_timeout_secs(dc.approval_timeout_secs)
.with_intents_mask(dc.intents_mask)
.with_reaction_notifications(dc.reaction_notifications),
))
}
#[cfg(not(feature = "channel-discord"))]
"discord" => {
anyhow::bail!("Discord channel requires the `channel-discord` feature");
}
#[cfg(feature = "channel-slack")]
"slack" => {
let sl = config
.channels
.slack
.get("default")
.context("Slack 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("slack", &alias))
};
let thread_context_max_messages_resolver =
slack_thread_context_max_messages_resolver(config_arc, &alias);
let workspace_dir = one_shot_channel_workspace_dir(&config, "slack", &alias);
let bot_token = sl.resolved_bot_token().with_context(|| {View on GitHub (pinned to 88bb9c8533)
Solutions
- Rebuild including the feature: `cargo build --features channel-discord`
- Use a distribution image that ships the discord feature
- Or drop `[channels.discord]` from config so the channel is never constructed
Example fix
# before cargo build --no-default-features --features channel-telegram # error: Discord channel requires the `channel-discord` feature # after cargo build --no-default-features --features "channel-telegram,channel-discord"
Defensive patterns
Strategy: validation
Validate before calling
#[cfg(not(feature = "channel-discord"))]
if !config.channels.discord.is_empty() {
log::warn!("[channels.discord.*] configured but `channel-discord` feature is off");
} Type guard
fn channel_feature_enabled(channel_type: &str) -> bool {
match channel_type {
"discord" => cfg!(feature = "channel-discord"),
"telegram" => cfg!(feature = "channel-telegram"),
"slack" => cfg!(feature = "channel-slack"),
"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-discord` feature") => {
// surface: rebuild with --features channel-discord or remove the discord config
} Prevention
- Enable every channel feature you configure, or strip config sections for disabled channels
- Pin feature sets in CI builds and diff them against config on deploy
- Prefer full-featured builds for developer machines to decouple config from build flags
When it happens
Trigger: A `[channels.discord.*]` alias is configured, or a one-shot send targets `discord.<alias>`, while the binary was compiled without `channel-discord`. Occurs at daemon channel construction and at build_channel_by_id for ad-hoc sends.
Common situations: Minimal docker/distro build with only some channels enabled; `--no-default-features` local build; config written on a full build then deployed to a slim build.
Related errors
- Telegram channel requires the `channel-telegram` feature
- Slack channel requires the `channel-slack` feature
- Mattermost channel requires the `channel-mattermost` feature
- Signal channel requires the `channel-signal` feature
- Matrix channel requires the `channel-matrix` feature
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/f88235b524c0017e.
Report an issue: GitHub.