zeroclaw-labs/zeroclaw · error

Bocha AI search returned error (code {code}): {msg}

Error message

Bocha AI search returned error (code {code}): {msg}

What it means

Error "Bocha AI search returned error (code {code}): {msg}" thrown in zeroclaw-labs/zeroclaw.

Source

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

        let status = response.status();
        if !status.is_success() {
            return Err(http_search_failure("bocha", status));
        }

        let json: serde_json::Value = response.json().await?;
        self.parse_bocha_results(&json, query)
    }

    fn parse_bocha_results(&self, json: &serde_json::Value, query: &str) -> anyhow::Result<String> {
        if let Some(code) = json.get("code").and_then(|c| c.as_i64())
            && code != 200
        {
            let msg = json
                .get("msg")
                .and_then(|m| m.as_str())
                .unwrap_or("(no message)");
            anyhow::bail!("Bocha AI search returned error (code {code}): {msg}");
        }

        let results = json
            .get("data")
            .and_then(|d| d.get("webPages"))
            .and_then(|w| w.get("value"))
            .and_then(|v| v.as_array())
            .ok_or_else(|| {
                ::zeroclaw_log::record!(
                    ERROR,
                    ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Fail)
                        .with_outcome(::zeroclaw_log::EventOutcome::Failure)
                        .with_attrs(::serde_json::json!({"search_provider": "bocha"})),
                    "web_search: invalid Bocha AI response"
                );
                anyhow::Error::msg("Invalid Bocha AI API response")
            })?;

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Check the Bocha AI error code and message: invalid key, quota exhaustion, or bad request parameters are the common causes.
  2. Verify the API key and account quota, then retry; switch providers if the error persists.

When it happens

Trigger: Thrown at crates/zeroclaw-tools/src/web_search_tool.rs:744 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/fea5fb4a08d7f206. Report an issue: GitHub.