tinyhumansai/openhuman · error · anyhow::Error

Missing required parameter: from_currency

Error message

Missing required parameter: from_currency

What it means

Currency conversion tool guard: the required 'from_currency' argument is missing, not a string, or blank. Fiat or crypto source currency codes (BTC, ETH, USD, EUR) are expected; to_currency is checked separately.

Source

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

                    "type": "string",
                    "description": "Source currency (fiat or crypto), e.g. BTC, ETH, USD, EUR"
                },
                "to_currency": {
                    "type": "string",
                    "description": "Target currency, e.g. USD"
                }
            },
            "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);

View on GitHub (pinned to 7491200858)

Solutions

  1. Supply from_currency as a currency code string, e.g. 'BTC'
  2. Ensure both from_currency and to_currency are provided in the same call
Defensive patterns

Strategy: validation

When it happens

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