tinyhumansai/openhuman · error · anyhow::Error

Missing required parameter: to_currency

Error message

Missing required parameter: to_currency

What it means

Required-parameter guard in the currency-exchange tool's execute: `to_currency` (or, on the preceding line, `from_currency`) is missing, non-string, or blank after trimming. Both are schema-required; this fires before the FX rate lookup when either side of the conversion pair is absent.

Source

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

                }
            },
            "required": ["from_currency", "to_currency"]
        })
    }

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

        tracing::info!("[stock_exchange_rate] {}->{}", from, to);

        let body = json!({ "fromCurrency": from, "toCurrency": to });
        match self
            .client
            .post::<ExchangeRateResponse>(PATH_EXCHANGE_RATE, &body)
            .await
        {
            Ok(resp) => {
                let r = &resp.rate;
                let mut out = format!("{}/{} = {}\n", r.from_currency, r.to_currency, r.rate);
                if let Some(bid) = r.bid {
                    out.push_str(&format!("  bid {}\n", bid));
                }
                if let Some(ask) = r.ask {
                    out.push_str(&format!("  ask {}\n", ask));
                }

View on GitHub (pinned to 7491200858)

Solutions

  1. Supply to_currency as a currency code string, e.g. 'USD'
  2. Check for typos in the to_currency key name
Defensive patterns

Strategy: validation

When it happens

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