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

X/Twitter channel requires the `channel-twitter` feature

Error message

X/Twitter channel requires the `channel-twitter` feature

What it means

Raised by build_channel_by_id when channel_id = "twitter" is requested but the binary was compiled without the `channel-twitter` feature. The enabled arm reads config.channels.twitter and wires the channel with alias and peer_resolver; without the feature the arm only bails, naming `channel-twitter`. The message itself uses the legacy name "X/Twitter".

Source

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

                .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,
            )))
        }
        #[cfg(not(feature = "channel-twitter"))]
        "twitter" => {
            anyhow::bail!("X/Twitter channel requires the `channel-twitter` feature");
        }
        #[cfg(feature = "channel-git")]
        "git" => {
            let g = config
                .channels
                .git
                .get("default")
                .context("Git 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("git", &alias))
            };
            Ok(Arc::new(GitChannel::new(g.clone(), alias, peer_resolver)?))
        }
        #[cfg(not(feature = "channel-git"))]
        "git" => {

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Rebuild with cargo build --release --features channel-twitter
  2. Or use --features channels-full
  3. Or remove [channels.twitter] and "twitter" bindings from config
  4. Confirm via zeroclaw_channels::listing::is_channel_type_compiled("twitter")

Example fix

# before
 cargo build --release

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

Strategy: validation

Validate before calling

use zeroclaw_channels::listing::is_channel_type_compiled;

if !is_channel_type_compiled("twitter") {
    eprintln!("rebuild with --features channel-twitter or remove [channels.twitter]");
}

Type guard

fn twitter_available() -> bool {
    zeroclaw_channels::listing::is_channel_type_compiled("twitter")
}

Try / catch

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

Prevention

When it happens

Trigger: start_channels / build_channel_by_id selecting "twitter" from an [channels.twitter] block or agent channel binding in a build lacking --features channel-twitter.

Common situations: Default-feature builds (twitter is in channels-full only); API-bridge setups where the operator enabled a subset of social channels; prebuilt binaries from before the channel was stabilized.

Related errors


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