tinyhumansai/openhuman · error · anyhow::Error

missing required number argument `amount_usd`

Error message

missing required number argument `amount_usd`

What it means

A money-moving billing tool (e.g. top-up) was invoked without the required `amount_usd` number (absent or not JSON number). Guard on the tool arguments before any external payment effect happens; the schema declares amount_usd required with minimum 0.

Source

Thrown at src/openhuman/hosted/billing/tools.rs:225

            "type": "object",
            "properties": {
                "amount_usd": { "type": "number", "minimum": 0 },
                "gateway": { "type": "string" }
            },
            "required": ["amount_usd"]
        })
    }
    fn permission_level(&self) -> PermissionLevel {
        PermissionLevel::Write
    }
    fn external_effect(&self) -> bool {
        true
    }
    async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {
        let amount = args
            .get("amount_usd")
            .and_then(Value::as_f64)
            .ok_or_else(|| anyhow::anyhow!("missing required number argument `amount_usd`"))?;
        let gateway = args
            .get("gateway")
            .and_then(Value::as_str)
            .map(str::to_string);
        emit!(
            billing::top_up_credits(&self.config, amount, gateway).await,
            "billing_top_up_credits"
        )
    }
}

/// Create a Coinbase crypto charge.
pub struct BillingCoinbaseChargeTool {
    config: Arc<Config>,
}
impl BillingCoinbaseChargeTool {
    pub fn new(config: Arc<Config>) -> Self {
        Self { config }

View on GitHub (pinned to 7491200858)

Solutions

  1. Pass amount_usd as a non-negative number
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/hosted/billing/tools.rs:225 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/2250ca829526b9cb. Report an issue: GitHub.