tinyhumansai/openhuman · error

missing required `{key}`

Error message

missing required `{key}`

What it means

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.

Source

Thrown at src/openhuman/tools/impl/network/mcp.rs:290

        if options.prefer_markdown && result.markdown_formatted.is_none() {
            result.markdown_formatted = Some(result.output());
        }
        Ok(result)
    }

    async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {
        self.execute_with_options(args, ToolCallOptions::default())
            .await
    }
}

fn required_string_arg(args: &Value, key: &str) -> anyhow::Result<String> {
    let value = args
        .get(key)
        .and_then(Value::as_str)
        .map(str::trim)
        .filter(|s| !s.is_empty())
        .ok_or_else(|| anyhow::anyhow!("missing required `{key}`"))?;
    Ok(value.to_string())
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::openhuman::config::{Config, McpServerConfig};

    fn test_registry() -> Arc<McpServerRegistry> {
        let mut config = Config::default();
        config.gitbooks.enabled = false;
        config.mcp_client.servers.push(McpServerConfig {
            name: "docs".into(),
            endpoint: "https://example.com/mcp".into(),
            command: String::new(),
            args: Vec::new(),
            env: std::collections::HashMap::new(),
            cwd: None,

View on GitHub (pinned to 7491200858)

Solutions

  1. Supply the named key as a non-empty string (whitespace-only values are rejected too)
  2. Check the tool's schema for which keys are required
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/tools/impl/network/mcp.rs:290 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/35df5516cadeb4c8. Report an issue: GitHub.