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

Twitch channel requires the `channel-twitch` feature

Error message

Twitch channel requires the `channel-twitch` feature

What it means

Raised by build_channel_by_id when channel_id = "twitch" is requested but the binary lacks the `channel-twitch` feature. In Cargo.toml, channel-twitch = ["channel-irc"] because the Twitch channel reuses the IRC transport, so enabling it also compiles the IRC channel; the reverse is not true — channel-irc alone leaves this bail in place.

Source

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

                .context("Twitch 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("twitch", &alias))
            };
            Ok(Arc::new(TwitchChannel::new(
                tw_cfg.bot_username.clone(),
                tw_cfg.oauth_token.clone(),
                tw_cfg.channels.clone(),
                tw_cfg.mention_only,
                alias,
                peer_resolver,
            )))
        }
        #[cfg(not(feature = "channel-twitch"))]
        "twitch" => {
            anyhow::bail!("Twitch channel requires the `channel-twitch` feature");
        }
        #[cfg(feature = "channel-twitter")]
        "twitter" => {
            let tw = config
                .channels
                .twitter
                .get("default")
                .context("X/Twitter 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("twitter", &alias))
            };
            Ok(Arc::new(TwitterChannel::new(
                tw.bearer_token.clone(),
                alias,
                peer_resolver,

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Rebuild with cargo build --release --features channel-twitch (implicitly enables channel-irc too)
  2. Or use --features channels-full
  3. Or remove [channels.twitch] and "twitch" bindings
  4. Verify with zeroclaw_channels::listing::is_channel_type_compiled("twitch")

Example fix

# before
 cargo build --release --features channel-irc   # irc compiled, twitch not

 # after
 cargo build --release --features channel-twitch
Defensive patterns

Strategy: validation

Validate before calling

use zeroclaw_channels::listing::is_channel_type_compiled;

if !is_channel_type_compiled("twitch") {
    eprintln!("rebuild with --features channel-twitch (channel-irc alone is not enough)");
}

Type guard

fn twitch_available() -> bool {
    zeroclaw_channels::listing::is_channel_type_compiled("twitch")
}

Try / catch

match build_channel_by_id(&config_arc, "twitch") {
    Ok(ch) => { /* use */ }
    Err(e) if e.to_string().contains("requires the `channel-twitch` feature") => {
        // skip; rebuild with channel-twitch
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: start_channels / build_channel_by_id selecting "twitch" from an [channels.twitch] block in a build without --features channel-twitch (a build with only channel-irc is not sufficient).

Common situations: Default-feature builds; operators who enabled channel-irc for IRC and assumed Twitch came with it; channels-full builds work, minimal builds with manual feature lists often forget twitch.

Related errors


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