tinyhumansai/openhuman · error · anyhow::Error

{name}: {e}

Error message

{name}: {e}

What it means

Generic emit! macro wrapper for the billing tools: a billing-domain RPC returned an RpcOutcome error and the macro prefixes it with the tool name before propagating. One message shape covers every billing read/mutator; the underlying error text distinguishes the actual backend/domain cause.

Source

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

//! LLM-callable wrappers over the `billing` domain.
//!
//! Reads (plan/balance/transactions/cards/coupons/auto-recharge + the Stripe
//! portal link) are default-ON. Every money-moving or payment-method mutator
//! ships default-OFF via `tools/user_filter.rs` (`billing_writes` toggle);
//! `billing_delete_card` is `Dangerous`.

use std::sync::Arc;

use async_trait::async_trait;
use serde_json::{json, Value};

use crate::openhuman::config::Config;
use crate::openhuman::hosted::billing;
use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolResult};

macro_rules! emit {
    ($outcome:expr, $name:literal) => {{
        let outcome = $outcome.map_err(|e| anyhow::anyhow!(concat!($name, ": {}"), e))?;
        Ok(ToolResult::success(serde_json::to_string(&outcome.value)?))
    }};
}

fn req_str(args: &serde_json::Value, key: &str) -> anyhow::Result<String> {
    args.get(key)
        .and_then(Value::as_str)
        .map(str::trim)
        .filter(|s| !s.is_empty())
        .map(str::to_string)
        .ok_or_else(|| anyhow::anyhow!("missing required string argument `{key}`"))
}

/// Read tool over a `&Config`-only `async fn -> Result<RpcOutcome<Value>, String>`.
macro_rules! cfg_read {
    ($ty:ident, $name:literal, $fn:ident, $desc:literal) => {
        pub struct $ty {
            config: Arc<Config>,

View on GitHub (pinned to 7491200858)

Solutions

  1. Read the suffixed error text for the billing-domain cause
  2. Verify session/auth state for backend billing calls
  3. Retry transient backend failures once
Defensive patterns

Strategy: try-catch

When it happens

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