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

Git channel requires the `channel-git` feature

Error message

Git channel requires the `channel-git` feature

What it means

Raised by build_channel_by_id when channel_id = "git" is requested but the binary lacks the `channel-git` feature. In Cargo.toml channel-git = ["provider-github", "provider-gitea"]: the feature bundles forge providers (GitHub App auth via jsonwebtoken, Gitea/Forgejo PAT). The enabled arm constructs GitChannel::new(g, alias, peer_resolver) from [channels.git].

Source

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

        }
        #[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" => {
            anyhow::bail!("Git channel requires the `channel-git` feature");
        }
        #[cfg(feature = "channel-mochat")]
        "mochat" => {
            let mc = config
                .channels
                .mochat
                .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,

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Rebuild with cargo build --release --features channel-git (brings provider-github and provider-gitea)
  2. Or use --features channels-full
  3. Or remove [channels.git] and "git" bindings
  4. Verify with zeroclaw_channels::listing::is_channel_type_compiled("git")

Example fix

# before
 cargo build --release --features provider-github   # provider alone is not the channel

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

Strategy: validation

Validate before calling

use zeroclaw_channels::listing::is_channel_type_compiled;

if !is_channel_type_compiled("git") {
    eprintln!("rebuild with --features channel-git (bundles provider-github + provider-gitea)");
}

Type guard

fn git_channel_available() -> bool {
    zeroclaw_channels::listing::is_channel_type_compiled("git")
}

Try / catch

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

Prevention

When it happens

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

Common situations: Default-feature builds (git is in channels-full only); self-hosted Gitea/Forgejo setups compiled from a minimal feature list; operators enabling provider-github alone and expecting the channel — provider features are sub-features of channel-git, not substitutes.

Related errors


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