tinyhumansai/openhuman · error

Brave news response shape changed: {e}

Error message

Brave news response shape changed: {e}

What it means

Deserializing the Brave news-search response into its typed struct failed. Same failure class as the web variant: the request succeeded and the body was valid JSON, but the field structure no longer matches the `BraveNewsResponse` struct — Brave's news endpoint schema drifted from what this parser was built against.

Source

Thrown at src/openhuman/search/tools/brave.rs:375

                "freshness": { "type": "string", "description": "Time filter: 'pd', 'pw', 'pm', 'py'." }
            },
            "required": ["query"]
        })
    }

    async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {
        let query = extract_query(&args)?;
        let count = clamped_count(&args, self.cfg.max_results, 20);
        let mut q: Vec<(&str, String)> = vec![("q", query.clone()), ("count", count.to_string())];
        if let Some(c) = pub_string(&args, "country") {
            q.push(("country", c));
        }
        if let Some(f) = pub_string(&args, "freshness") {
            q.push(("freshness", f));
        }
        let raw = brave_get(&self.cfg, "/news/search", &q).await?;
        let parsed: NewsResp = serde_json::from_value(raw)
            .map_err(|e| anyhow::anyhow!("Brave news response shape changed: {e}"))?;
        let mut lines = if parsed.results.is_empty() {
            return Ok(ToolResult::success(format!("No news found for: {query}")));
        } else {
            vec![format!("News results for: {query} (via Brave)")]
        };
        for (i, r) in parsed.results.iter().take(count).enumerate() {
            let title = if r.title.trim().is_empty() {
                "Untitled"
            } else {
                r.title.trim()
            };
            lines.push(format!("{}. {}", i + 1, title));
            lines.push(format!("   {}", r.url.trim()));
            if let Some(src) = r.source.as_deref() {
                let src = src.trim();
                if !src.is_empty() {
                    lines.push(format!("   Source: {src}"));
                }

View on GitHub (pinned to 7491200858)

Solutions

  1. Inspect a raw news response and compare it field-by-field with the news struct in brave.rs
  2. Update the struct to match the current schema, preferring `Option<T>` for fields Brave may omit
  3. Pin down whether the change is endpoint-specific — news can drift independently of web
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/openhuman/search/tools/brave.rs:375 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/cc04222d520bb7e7. Report an issue: GitHub.