{"record":{"id":"e66438d97871e04b","repo":"tinyhumansai/openhuman","slug":"tool-set-user-state-failed-e","errorCode":null,"errorMessage":"{tool}: set_user_state failed: {e:#}","messagePattern":"(.+?): set_user_state failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/agent/learning/tools.rs","lineNumber":283,"sourceCode":"            \"facet\": facet_to_json(&facet),\n        }))?))\n    }\n}\n\n/// Set/clear a facet's pin via `set_user_state`. Shared by pin/unpin.\nasync fn set_pin(\n    args: serde_json::Value,\n    tool: &str,\n    state: UserState,\n) -> anyhow::Result<ToolResult> {\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 updated = cache\n        .set_user_state(&fk, state)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"{tool}: set_user_state failed: {e:#}\"))?;\n    if !updated {\n        return Err(anyhow::anyhow!(\"{tool}: facet not found: {fk}\"));\n    }\n    let facet = cache\n        .get(&fk)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"{tool}: re-read failed: {e:#}\"))?;\n    Ok(ToolResult::success(serde_json::to_string(&json!({\n        \"facet\": facet.as_ref().map(facet_to_json),\n    }))?))\n}\n\n/// Pin a facet. Default-OFF.\npub struct LearningPinFacetTool;\n\n#[async_trait]\nimpl Tool for LearningPinFacetTool {\n    fn name(&self) -> &str {","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/agent/learning/tools.rs#L265-L301","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/agent/learning/tools.rs:283 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the pin/unpin tool call","Check the underlying driver error for store health issues","Confirm the facet's user_state afterwards with 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"}