{"record":{"id":"c40886c470bd756a","repo":"tinyhumansai/openhuman","slug":"max-results-must-be-a-positive-integer","errorCode":null,"errorMessage":"max_results must be a positive integer","messagePattern":"max_results must be a positive integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/search/tools/searxng.rs","lineNumber":423,"sourceCode":"            .collect::<anyhow::Result<Vec<_>>>()?,\n        None => Vec::new(),\n    };\n    let language = match object.get(\"language\") {\n        Some(value) => {\n            let language = value\n                .as_str()\n                .map(str::trim)\n                .filter(|value| !value.is_empty())\n                .ok_or_else(|| anyhow::anyhow!(\"language must be a non-empty string\"))?;\n            Some(language.to_string())\n        }\n        None => None,\n    };\n    let max_results = match object.get(\"max_results\") {\n        Some(value) => {\n            let max_results = value\n                .as_u64()\n                .ok_or_else(|| anyhow::anyhow!(\"max_results must be a positive integer\"))?;\n            Some(max_results.clamp(1, MAX_RESULTS as u64) as usize)\n        }\n        None => None,\n    };\n\n    Ok(SearxngSearchArgs {\n        query,\n        categories,\n        language,\n        max_results,\n    })\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    fn tool(base_url: String) -> SearxngSearchTool {","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/search/tools/searxng.rs#L405-L441","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/search/tools/searxng.rs:423 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":"type-guard","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"}