tinyhumansai/openhuman · error · anyhow::Error

Missing required parameter: commodity

Error message

Missing required parameter: commodity

What it means

Required-parameter guard in the commodity-price tool's execute: `commodity` is missing, non-string, or trims to empty. Schema-required; fires before the price-history request, so the caller must name the commodity (e.g. a symbol from the tool's accepted set).

Source

Thrown at src/openhuman/integrations/tools/stock_prices.rs:542

                "limit": {
                    "type": "integer",
                    "description": "Max points (default 30)",
                    "minimum": 1,
                    "maximum": 1000,
                    "default": 30
                }
            },
            "required": ["commodity"]
        })
    }

    async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {
        let commodity = args
            .get("commodity")
            .and_then(|v| v.as_str())
            .map(str::trim)
            .filter(|s| !s.is_empty())
            .ok_or_else(|| anyhow::anyhow!("Missing required parameter: commodity"))?;

        let mut body = json!({ "commodity": commodity });
        if let Some(i) = args.get("interval").and_then(|v| v.as_str()) {
            body["interval"] = json!(i);
        }
        if let Some(l) = args.get("limit").and_then(|v| v.as_u64()) {
            body["limit"] = json!(l.clamp(1, 1000));
        }

        tracing::info!("[stock_commodity] {}", commodity);

        match self
            .client
            .post::<CommodityResponse>(PATH_COMMODITY, &body)
            .await
        {
            Ok(resp) => {
                let s = &resp.series;

View on GitHub (pinned to 7491200858)

Solutions

  1. Supply a non-empty commodity name supported by the prices provider
  2. Check the tool schema's commodity description for accepted values
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/integrations/tools/stock_prices.rs:542 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/b28d6c14f0c0f72e. Report an issue: GitHub.