tinyhumansai/openhuman · error

: set_user_state failed

Error message

{tool}: set_user_state failed: {e:#}

What it means

The shared pin/unpin helper called set_user_state to change a facet's pin state and the memory-driver write failed. The tool name in the message says which of pin/unpin was in flight; the state change did not persist.

Solutions

  1. Retry the pin/unpin tool call
  2. Check the underlying driver error for store health issues
  3. Confirm the facet's user_state afterwards with learning_get_facet
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/openhuman/agent/learning/tools.rs:283 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/e66438d97871e04b. Report an issue: GitHub.

Appendix: source

Thrown at src/openhuman/agent/learning/tools.rs:283

            "facet": facet_to_json(&facet),
        }))?))
    }
}

/// Set/clear a facet's pin via `set_user_state`. Shared by pin/unpin.
async fn set_pin(
    args: serde_json::Value,
    tool: &str,
    state: UserState,
) -> anyhow::Result<ToolResult> {
    let class_str = read_required_str(&args, "class")?;
    let key_suffix = read_required_str(&args, "key")?;
    let fk = full_key(&class_str, &key_suffix);
    let cache = get_cache().await?;
    let updated = cache
        .set_user_state(&fk, state)
        .await
        .map_err(|e| anyhow::anyhow!("{tool}: set_user_state failed: {e:#}"))?;
    if !updated {
        return Err(anyhow::anyhow!("{tool}: facet not found: {fk}"));
    }
    let facet = cache
        .get(&fk)
        .await
        .map_err(|e| anyhow::anyhow!("{tool}: re-read failed: {e:#}"))?;
    Ok(ToolResult::success(serde_json::to_string(&json!({
        "facet": facet.as_ref().map(facet_to_json),
    }))?))
}

/// Pin a facet. Default-OFF.
pub struct LearningPinFacetTool;

#[async_trait]
impl Tool for LearningPinFacetTool {
    fn name(&self) -> &str {

View on GitHub (pinned to 7491200858)