{"record":{"id":"35df5516cadeb4c8","repo":"tinyhumansai/openhuman","slug":"missing-required-key","errorCode":null,"errorMessage":"missing required `{key}`","messagePattern":"missing required `(.+?)`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/tools/impl/network/mcp.rs","lineNumber":290,"sourceCode":"        if options.prefer_markdown && result.markdown_formatted.is_none() {\n            result.markdown_formatted = Some(result.output());\n        }\n        Ok(result)\n    }\n\n    async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {\n        self.execute_with_options(args, ToolCallOptions::default())\n            .await\n    }\n}\n\nfn required_string_arg(args: &Value, key: &str) -> anyhow::Result<String> {\n    let value = args\n        .get(key)\n        .and_then(Value::as_str)\n        .map(str::trim)\n        .filter(|s| !s.is_empty())\n        .ok_or_else(|| anyhow::anyhow!(\"missing required `{key}`\"))?;\n    Ok(value.to_string())\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use crate::openhuman::config::{Config, McpServerConfig};\n\n    fn test_registry() -> Arc<McpServerRegistry> {\n        let mut config = Config::default();\n        config.gitbooks.enabled = false;\n        config.mcp_client.servers.push(McpServerConfig {\n            name: \"docs\".into(),\n            endpoint: \"https://example.com/mcp\".into(),\n            command: String::new(),\n            args: Vec::new(),\n            env: std::collections::HashMap::new(),\n            cwd: None,","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/tools/impl/network/mcp.rs#L272-L308","documentation":"Generic guard in the required_string_arg helper: it extracts a trimmed, non-empty string for the named key (e.g. 'server' or 'tool' for mcp_call) and errors when the key is absent, not a string, or blank. The {key} in the message names exactly which input is at fault.","triggerScenarios":"Thrown at src/openhuman/tools/impl/network/mcp.rs:290 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply the named key as a non-empty string (whitespace-only values are rejected too)","Check the tool's schema for which keys are required"],"exampleFix":null,"handlingStrategy":"validation","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"}