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

Lark channel requires the `channel-lark` feature

Error message

Lark channel requires the `channel-lark` feature

What it means

Raised by build_channel_by_id when the config selects the Lark channel but the binary was compiled without the `channel-lark` Cargo feature. The Lark arm is written as an inner cfg block inside `"lark" =>`, so without the feature the whole arm body reduces to the bail. `channel-lark` also pulls the optional `prost` dependency, so enabling it changes the dependency graph, not just a cfg flag.

Source

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

                    let alias = alias.clone();
                    Arc::new(move || cfg_arc.read().channel_external_peers("lark", &alias))
                };
                Ok(Arc::new(
                    LarkChannel::from_config(lk, alias, peer_resolver)
                        .with_workspace_dir(one_shot_channel_workspace_dir(
                            &config, "lark", "default",
                        ))
                        .with_approval_timeout_secs(lk.approval_timeout_secs)
                        .with_per_user_session(lk.per_user_session)
                        .with_ack_reactions(
                            lk.ack_reactions.unwrap_or(config.channels.ack_reactions),
                        )
                        .with_streaming(lk.stream_mode, lk.draft_update_interval_ms),
                ))
            }
            #[cfg(not(feature = "channel-lark"))]
            {
                anyhow::bail!("Lark channel requires the `channel-lark` feature");
            }
        }
        #[cfg(feature = "channel-dingtalk")]
        "dingtalk" => {
            let dt = config
                .channels
                .dingtalk
                .get("default")
                .context("DingTalk 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("dingtalk", &alias))
            };
            Ok(Arc::new(
                DingTalkChannel::new(
                    dt.client_id.clone(),

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Rebuild with the feature: cargo build --release --features channel-lark (or add it to the feature list of the binary crate you run)
  2. Or use --features channels-full, which includes channel-lark
  3. Or drop the [channels.lark] section and any "lark" bindings from config
  4. Check compilation status first via zeroclaw_channels::listing::is_channel_type_compiled("lark")

Example fix

# before
 cargo build --release            # no channel-lark

 # after
 cargo build --release --features channel-lark   # pulls dep:prost
Defensive patterns

Strategy: validation

Validate before calling

use zeroclaw_channels::listing::is_channel_type_compiled;

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

Type guard

fn lark_available() -> bool {
    zeroclaw_channels::listing::is_channel_type_compiled("lark")
}

Try / catch

match build_channel_by_id(&config_arc, "lark") {
    Ok(ch) => { /* use */ }
    Err(e) if e.to_string().contains("requires the `channel-lark` feature") => {
        // degrad: disable lark bindings and continue with other channels
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: start_channels / build_channel_by_id resolving channel_id = "lark" (from [channels.lark] or an agent channel binding) in a build without `--features channel-lark`. Config parsing and validation succeed; construction of LarkChannel (lark.rs, LineChannel-style from_config path) is never compiled in.

Common situations: Default-feature builds (Lark is only in `channels-full`, not `default-channels`), stale prebuilt binaries from before Lark support, or enabling Lark in config on a host where the daemon was built from a minimal feature set to cut compile time.

Related errors


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