{"record":{"id":"68c5f44033d2dd94","repo":"tinyhumansai/openhuman","slug":"brave-returned-status-detail","errorCode":null,"errorMessage":"Brave returned {status}: {detail}","messagePattern":"Brave returned (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/search/tools/brave.rs","lineNumber":97,"sourceCode":"        .query(query)\n        .send()\n        .await\n        .map_err(|e| {\n            tracing::warn!(path = %path, \"[brave] request send failed: {e}\");\n            anyhow::anyhow!(\"Brave request failed: {e}\")\n        })?;\n    let status = resp.status();\n    let elapsed_ms = started.elapsed().as_millis();\n    let body = resp.text().await.unwrap_or_default();\n    if !status.is_success() {\n        let detail = crate::openhuman::util::utf8_safe_prefix_at_byte_boundary(&body, 500);\n        tracing::warn!(\n            path = %path,\n            status = %status,\n            elapsed_ms = elapsed_ms as u64,\n            \"[brave] non-2xx response: {detail}\"\n        );\n        anyhow::bail!(\"Brave returned {status}: {detail}\");\n    }\n    tracing::debug!(\n        path = %path,\n        status = %status,\n        elapsed_ms = elapsed_ms as u64,\n        body_bytes = body.len(),\n        \"[brave] response ok\"\n    );\n    serde_json::from_str::<Value>(&body).map_err(|e| {\n        tracing::warn!(path = %path, \"[brave] JSON parse failed: {e}\");\n        anyhow::anyhow!(\"Brave returned malformed JSON: {e}\")\n    })\n}\n\nfn extract_query(args: &Value) -> anyhow::Result<String> {\n    let q = args\n        .get(\"query\")\n        .and_then(|v| v.as_str())","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/search/tools/brave.rs#L79-L115","documentation":"brave_get got a non-success HTTP status from the Brave API; the body prefix (bounded to 500 chars, UTF-8-safe) is embedded as {detail}. Rate limits, quota exhaustion and an invalid API key all surface here with different statuses.","triggerScenarios":"Thrown at src/openhuman/search/tools/brave.rs:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry after the rate-limit window if the status is 429","Check the Brave API key under Connections > Search engine for 401/403","Read {detail} for Brave's own reason"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}