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

Telegram channel requires the `channel-telegram` feature

Error message

Telegram channel requires the `channel-telegram` feature

What it means

Thrown by build_channel_by_id when channel_type is `telegram` but the crate was compiled without the `channel-telegram` cargo feature. Feature-gated match arms mean the Telegram client code is not in the binary at all, so constructing the channel runtime is impossible; the bail names the missing feature explicitly.

Source

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

                    tg.bot_token.clone(),
                    alias.clone(),
                    peer_resolver,
                    tg.mention_only,
                )
                .with_voice_peer_resolver(voice_peer_resolver)
                .with_persistence(config_arc.clone())
                .with_api_base(tg.api_base_url.clone())
                .with_ack_reactions(ack)
                .with_streaming(tg.stream_mode, tg.draft_update_interval_ms)
                .with_transcription(config.transcription.clone())
                .with_tts(&config)
                .with_workspace_dir(workspace_dir)
                .with_approval_timeout_secs(tg.approval_timeout_secs),
            ))
        }
        #[cfg(not(feature = "channel-telegram"))]
        "telegram" => {
            anyhow::bail!("Telegram channel requires the `channel-telegram` feature");
        }
        #[cfg(feature = "channel-discord")]
        "discord" => {
            let dc = config
                .channels
                .discord
                .get("default")
                .context("Discord 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("discord", &alias))
            };
            let workspace_dir = one_shot_channel_workspace_dir(&config, "discord", &alias);
            Ok(Arc::new(
                DiscordChannel::new(
                    dc.bot_token.clone(),

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Rebuild with the feature enabled: `cargo build --features channel-telegram` (or add it to the zeroclaw-channels features list in your workspace build)
  2. Check how your binary was produced — distro packages/docker images document which channel features they enable; pick a build that includes telegram
  3. Or remove/disable the `[channels.telegram]` sections so startup no longer tries to construct the channel

Example fix

# before
cargo build --no-default-features
# error: Telegram channel requires the `channel-telegram` feature

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

Strategy: validation

Validate before calling

// At startup, check config channel types against the compiled feature set:
#[cfg(not(feature = "channel-telegram"))]
if !config.channels.telegram.is_empty() {
    log::warn!("[channels.telegram.*] configured but `channel-telegram` feature is off; channel will fail");
}

Type guard

fn channel_feature_enabled(channel_type: &str) -> bool {
    match channel_type {
        "telegram" => cfg!(feature = "channel-telegram"),
        "discord" => cfg!(feature = "channel-discord"),
        "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-telegram` feature") => {
    // report build/config mismatch: rebuild with the feature or drop the channel section
}

Prevention

When it happens

Trigger: Config contains a `[channels.telegram.*]` section (or a gateway/one-shot send targets telegram.*) and the zeroclaw-channels crate was built with default features or a feature set omitting `channel-telegram`. Hits both daemon startup channel construction and the one-shot delivery path's build_channel_by_id call.

Common situations: Distro or docker image built with a minimal feature set to shrink the binary; feature flags changed in Cargo.toml during an upgrade; local build with `--no-default-features` while the config was written against a full-featured release build.

Related errors


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