{"record":{"id":"1f452668d790a3c7","repo":"tinyhumansai/openhuman","slug":"tool-re-read-failed-e","errorCode":null,"errorMessage":"{tool}: re-read failed: {e:#}","messagePattern":"(.+?): re-read failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/agent/learning/tools.rs","lineNumber":290,"sourceCode":"    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 {\n        \"learning_pin_facet\"\n    }\n\n    fn description(&self) -> &str {\n        \"Pin a learned facet (`class` + `key`) so it stays active regardless of \\\n         the stability detector.\"\n    }","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/agent/learning/tools.rs#L272-L308","documentation":"After a successful set_user_state in the pin/unpin helper, re-reading the facet to render the tool result failed — a driver read error on the verification pass. The state change likely landed but the tool could not confirm/show it.","triggerScenarios":"Thrown at src/openhuman/agent/learning/tools.rs:290 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the read (learning_get_facet) to confirm the new state","Treat the pin/unpin as probably applied and verify rather than assuming failure","Check driver health if re-reads keep failing"],"exampleFix":null,"handlingStrategy":"retry","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"}