tinyhumansai/openhuman · error

learning_forget_facet: upsert failed

Error message

learning_forget_facet: upsert failed: {e:#}

What it means

forget_facet found the facet and set user_state = Forgotten, but persisting that state via cache upsert failed — a driver write error. The user asked to forget material; if this errors out, the facet may still influence future turns, which is why the write failure is surfaced rather than swallowed.

Solutions

  1. Retry forget_facet — it is idempotent (state is re-read then re-written)
  2. Check memory store health if upserts persistently fail
  3. Verify afterwards that the facet reports Forgotten via learning_get_facet
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

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

    async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {
        log::debug!("[tool][learning] forget_facet invoked");
        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 facet_json = match cache
            .get(&fk)
            .await
            .map_err(|e| anyhow::anyhow!("learning_forget_facet: {e:#}"))?
        {
            Some(mut f) => {
                f.user_state = UserState::Forgotten;
                f.state = FacetState::Dropped;
                cache
                    .upsert(&f)
                    .await
                    .map_err(|e| anyhow::anyhow!("learning_forget_facet: upsert failed: {e:#}"))?;
                facet_to_json(&f)
            }
            None => serde_json::Value::Null,
        };
        Ok(ToolResult::success(serde_json::to_string(&json!({
            "facet": facet_json,
        }))?))
    }
}

/// Rebuild the facet cache (heavyweight stability cycle). Default-OFF.
pub struct LearningRebuildCacheTool;

#[async_trait]
impl Tool for LearningRebuildCacheTool {
    fn name(&self) -> &str {
        "learning_rebuild_cache"
    }

View on GitHub (pinned to 7491200858)