zeroclaw-labs/zeroclaw · error

Bocha AI API key not configured (decrypted value is empty)

Error message

Bocha AI API key not configured (decrypted value is empty)

What it means

Provider configuration guard in resolve_bocha_api_key: no non-empty Bocha AI API key is available (unset or decrypts empty), so Bocha search cannot be called. The message names the exact config key and the key-issuance URL.

Solutions

  1. Set the Bocha AI API key in the web_search configuration or via `zeroclaw quickstart`.
  2. Re-enter the key if the decrypted value came back empty.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-tools/src/web_search_tool.rs:686 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at crates/zeroclaw-tools/src/web_search_tool.rs:686

                    ERROR,
                    ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Reject)
                        .with_outcome(::zeroclaw_log::EventOutcome::Failure)
                        .with_attrs(::serde_json::json!({"search_provider": "bocha"})),
                    "web_search: Bocha AI API key not configured"
                );
                anyhow::Error::msg(
                    "Bocha AI API key not configured. Set [web_search] bocha_api_key in \
                     config.toml. Obtain one at https://open.bochaai.com",
                )
            })?;

        if zeroclaw_config::secrets::SecretStore::is_encrypted(&raw_key) {
            let zeroclaw_dir = self.config_path.parent().unwrap_or_else(|| Path::new("."));
            let store =
                zeroclaw_config::secrets::SecretStore::new(zeroclaw_dir, self.secrets_encrypt);
            let plaintext = store.decrypt(&raw_key)?;
            if plaintext.is_empty() {
                anyhow::bail!("Bocha AI API key not configured (decrypted value is empty)");
            }
            Ok(plaintext)
        } else {
            Ok(raw_key)
        }
    }

    async fn search_bocha(&self, query: &str) -> anyhow::Result<String> {
        let builder = reqwest::Client::builder().timeout(Duration::from_secs(self.timeout_secs));
        let builder =
            zeroclaw_config::schema::apply_runtime_proxy_to_builder(builder, "tool.web_search");
        let client = builder.build()?;
        self.search_bocha_with_client(&client, "https://api.bochaai.com/v1/web-search", query)
            .await
    }

    async fn search_bocha_with_client(
        &self,

View on GitHub (pinned to 88bb9c8533)