{"record":{"id":"a9c9b69cdc27cbcb","repo":"tinyhumansai/openhuman","slug":"error-a9c9b6","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/tinyplace/agent_tools/common.rs","lineNumber":382,"sourceCode":"    err_md(sdk_error_text(action, err))\n}\n\n/// Convenience: turn an SDK `Result` into `anyhow::Result<Value>`, rendering\n/// the error as markdown carried in the `anyhow` message (the FlowTool surfaces\n/// it to the LLM verbatim).\n///\n/// Serialization errors are **propagated**, not hidden: a response that fails to\n/// deserialize is a real bug worth surfacing. Callers hitting endpoints that\n/// return `null` for an *empty* collection should use [`list_or_empty`] instead,\n/// which degrades only that specific case.\npub fn val_or_err<T: serde::Serialize>(\n    action: &str,\n    result: tinyplace::Result<T>,\n) -> anyhow::Result<Value> {\n    match result {\n        Ok(v) => serde_json::to_value(v)\n            .map_err(|e| anyhow::anyhow!(\"failed to serialize {action} response: {e}\")),\n        Err(e) => Err(anyhow::anyhow!(\"{}\", sdk_error_text(action, e))),\n    }\n}\n\n/// Like [`val_or_err`], but for the narrow set of SDK calls whose backend\n/// returns `null` for an empty collection (`{\"messages\": null}`, empty\n/// submissions) — which the typed SDK surfaces as a `Serialization` error.\n/// Degrades **only** that case to an empty array; every other error, including a\n/// genuine shape mismatch, is still surfaced. Mirrors the `*_degrade` handling\n/// in the internal controllers, scoped to the endpoints that actually need it.\npub fn list_or_empty<T: serde::Serialize>(\n    action: &str,\n    result: tinyplace::Result<T>,\n) -> anyhow::Result<Value> {\n    match result {\n        Ok(v) => serde_json::to_value(v)\n            .map_err(|e| anyhow::anyhow!(\"failed to serialize {action} response: {e}\")),\n        Err(e) if is_empty_state(&e) => Ok(Value::Array(Vec::new())),\n        Err(e) => Err(anyhow::anyhow!(\"{}\", sdk_error_text(action, e))),","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/tinyplace/agent_tools/common.rs#L364-L400","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/tinyplace/agent_tools/common.rs:382 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the rendered markdown body for the underlying tiny.place SDK error","Address the SDK-level cause (auth, missing resource, network) and retry","Do not treat this as a serialization bug; it is deliberate pass-through"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}