tinyhumansai/openhuman · error · anyhow::Error

{}

Error message

{}

What it means

Pass-through error in the tiny.place val_or_err helper: a non-ok SDK Result is rendered as markdown via sdk_error_text and carried verbatim in the anyhow message so the FlowTool surfaces it to the LLM. The {0} body is the already-rendered SDK error text, not a new failure.

Source

Thrown at src/openhuman/tinyplace/agent_tools/common.rs:382

    err_md(sdk_error_text(action, err))
}

/// Convenience: turn an SDK `Result` into `anyhow::Result<Value>`, rendering
/// the error as markdown carried in the `anyhow` message (the FlowTool surfaces
/// it to the LLM verbatim).
///
/// Serialization errors are **propagated**, not hidden: a response that fails to
/// deserialize is a real bug worth surfacing. Callers hitting endpoints that
/// return `null` for an *empty* collection should use [`list_or_empty`] instead,
/// which degrades only that specific case.
pub fn val_or_err<T: serde::Serialize>(
    action: &str,
    result: tinyplace::Result<T>,
) -> anyhow::Result<Value> {
    match result {
        Ok(v) => serde_json::to_value(v)
            .map_err(|e| anyhow::anyhow!("failed to serialize {action} response: {e}")),
        Err(e) => Err(anyhow::anyhow!("{}", sdk_error_text(action, e))),
    }
}

/// Like [`val_or_err`], but for the narrow set of SDK calls whose backend
/// returns `null` for an empty collection (`{"messages": null}`, empty
/// submissions) — which the typed SDK surfaces as a `Serialization` error.
/// Degrades **only** that case to an empty array; every other error, including a
/// genuine shape mismatch, is still surfaced. Mirrors the `*_degrade` handling
/// in the internal controllers, scoped to the endpoints that actually need it.
pub fn list_or_empty<T: serde::Serialize>(
    action: &str,
    result: tinyplace::Result<T>,
) -> anyhow::Result<Value> {
    match result {
        Ok(v) => serde_json::to_value(v)
            .map_err(|e| anyhow::anyhow!("failed to serialize {action} response: {e}")),
        Err(e) if is_empty_state(&e) => Ok(Value::Array(Vec::new())),
        Err(e) => Err(anyhow::anyhow!("{}", sdk_error_text(action, e))),

View on GitHub (pinned to 7491200858)

Solutions

  1. Read the rendered markdown body for the underlying tiny.place SDK error
  2. Address the SDK-level cause (auth, missing resource, network) and retry
  3. Do not treat this as a serialization bug; it is deliberate pass-through
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/openhuman/tinyplace/agent_tools/common.rs:382 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/a9c9b69cdc27cbcb. Report an issue: GitHub.