tinyhumansai/openhuman · error

Search query cannot be empty

Error message

Search query cannot be empty

What it means

extract_query found the `query` argument present but blank after trimming — an argument-shape error from the calling model, not a Brave-side failure. The missing-parameter case is a separate error.

Source

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

        status = %status,
        elapsed_ms = elapsed_ms as u64,
        body_bytes = body.len(),
        "[brave] response ok"
    );
    serde_json::from_str::<Value>(&body).map_err(|e| {
        tracing::warn!(path = %path, "[brave] JSON parse failed: {e}");
        anyhow::anyhow!("Brave returned malformed JSON: {e}")
    })
}

fn extract_query(args: &Value) -> anyhow::Result<String> {
    let q = args
        .get("query")
        .and_then(|v| v.as_str())
        .ok_or_else(|| anyhow::anyhow!("Missing required parameter: query"))?
        .trim();
    if q.is_empty() {
        anyhow::bail!("Search query cannot be empty");
    }
    Ok(q.to_string())
}

fn clamped_count(args: &Value, default: usize, max: usize) -> usize {
    args.get("count")
        .and_then(|v| v.as_u64())
        .map(|n| (n as usize).clamp(1, max))
        .unwrap_or_else(|| default.clamp(1, max))
}

fn pub_string(args: &Value, key: &str) -> Option<String> {
    args.get(key)
        .and_then(|v| v.as_str())
        .map(|s| s.trim().to_string())
        .filter(|s| !s.is_empty())
}

View on GitHub (pinned to 7491200858)

Solutions

  1. Re-issue the tool call with a non-empty query string
Defensive patterns

Strategy: validation

When it happens

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