tinyhumansai/openhuman · error
max_results must be a positive integer
Error message
max_results must be a positive integer
What it means
Optional-field type guard in parse_search_args: "max_results" was provided but is not a positive integer usable as a result cap (wrong JSON type — string, float, negative, or zero). The faulting input is a max_results value that fails positive-integer validation.
Source
Thrown at src/openhuman/search/tools/searxng.rs:423
.collect::<anyhow::Result<Vec<_>>>()?,
None => Vec::new(),
};
let language = match object.get("language") {
Some(value) => {
let language = value
.as_str()
.map(str::trim)
.filter(|value| !value.is_empty())
.ok_or_else(|| anyhow::anyhow!("language must be a non-empty string"))?;
Some(language.to_string())
}
None => None,
};
let max_results = match object.get("max_results") {
Some(value) => {
let max_results = value
.as_u64()
.ok_or_else(|| anyhow::anyhow!("max_results must be a positive integer"))?;
Some(max_results.clamp(1, MAX_RESULTS as u64) as usize)
}
None => None,
};
Ok(SearxngSearchArgs {
query,
categories,
language,
max_results,
})
}
#[cfg(test)]
mod tests {
use super::*;
fn tool(base_url: String) -> SearxngSearchTool {View on GitHub (pinned to 7491200858)
Solutions
- Pass max_results as a positive integer, e.g. 10.
- Omit the field to use the tool's default cap.
- Coerce string-typed numbers ("10") to integers before invoking.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at src/openhuman/search/tools/searxng.rs:423 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/c40886c470bd756a.
Report an issue: GitHub.