{"record":{"id":"cbd4e4c95b27eef2","repo":"tinyhumansai/openhuman","slug":"learning-forget-facet-upsert-failed-e","errorCode":null,"errorMessage":"learning_forget_facet: upsert failed: {e:#}","messagePattern":"learning_forget_facet: upsert failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/agent/learning/tools.rs","lineNumber":404,"sourceCode":"\n    async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {\n        log::debug!(\"[tool][learning] forget_facet invoked\");\n        let class_str = read_required_str(&args, \"class\")?;\n        let key_suffix = read_required_str(&args, \"key\")?;\n        let fk = full_key(&class_str, &key_suffix);\n        let cache = get_cache().await?;\n        let facet_json = match cache\n            .get(&fk)\n            .await\n            .map_err(|e| anyhow::anyhow!(\"learning_forget_facet: {e:#}\"))?\n        {\n            Some(mut f) => {\n                f.user_state = UserState::Forgotten;\n                f.state = FacetState::Dropped;\n                cache\n                    .upsert(&f)\n                    .await\n                    .map_err(|e| anyhow::anyhow!(\"learning_forget_facet: upsert failed: {e:#}\"))?;\n                facet_to_json(&f)\n            }\n            None => serde_json::Value::Null,\n        };\n        Ok(ToolResult::success(serde_json::to_string(&json!({\n            \"facet\": facet_json,\n        }))?))\n    }\n}\n\n/// Rebuild the facet cache (heavyweight stability cycle). Default-OFF.\npub struct LearningRebuildCacheTool;\n\n#[async_trait]\nimpl Tool for LearningRebuildCacheTool {\n    fn name(&self) -> &str {\n        \"learning_rebuild_cache\"\n    }","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/agent/learning/tools.rs#L386-L422","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/agent/learning/tools.rs:404 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry forget_facet — it is idempotent (state is re-read then re-written)","Check memory store health if upserts persistently fail","Verify afterwards that the facet reports Forgotten via learning_get_facet"],"exampleFix":null,"handlingStrategy":"try-catch","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-23T08:17:48.524Z"}