tinyhumansai/openhuman · error

Brave image response shape changed: {e}

Error message

Brave image response shape changed: {e}

What it means

Deserializing the Brave image-search response into its typed struct failed. Same failure class as the web/news variants: valid JSON arrived but its shape does not match the image response struct — Brave's image endpoint schema changed relative to this parser.

Source

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

            "properties": {
                "query": { "type": "string", "description": "Image search query." },
                "count": { "type": "integer", "description": "Max results (1-20)." },
                "country": { "type": "string", "description": "2-letter country code." }
            },
            "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));
        }
        let raw = brave_get(&self.cfg, "/images/search", &q).await?;
        let parsed: ImageResp = serde_json::from_value(raw)
            .map_err(|e| anyhow::anyhow!("Brave image response shape changed: {e}"))?;
        if parsed.results.is_empty() {
            return Ok(ToolResult::success(format!("No images found for: {query}")));
        }
        let mut lines = vec![format!("Image 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));
            if let Some(src) = r.properties.as_ref().and_then(|p| p.url.as_deref()) {
                lines.push(format!("   Image: {}", src.trim()));
            }
            lines.push(format!("   Page: {}", r.url.trim()));
            if let Some(thumb) = r.thumbnail.as_ref().and_then(|t| t.src.as_deref()) {
                lines.push(format!("   Thumb: {}", thumb.trim()));
            }

View on GitHub (pinned to 7491200858)

Solutions

  1. Fetch a raw image-search response and diff it against the image struct in brave.rs
  2. Update the struct to the current schema, using `Option<T>` where fields may be absent
  3. Check Brave's API changelog — image result fields (thumbnails, source URLs) are the usual drift points
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/openhuman/search/tools/brave.rs:491 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/b87f488e4c097f92. Report an issue: GitHub.