{"record":{"id":"de0ddaf821d215c1","repo":"tinyhumansai/openhuman","slug":"failed-to-read-e-de0dda","errorCode":null,"errorMessage":"Failed to read {}: {e}","messagePattern":"Failed to read (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/tools/impl/filesystem/update_memory_md.rs","lineNumber":404,"sourceCode":"            \"[update_memory_md] replaced section '{}' in {file} ({} bytes written)\",\n            section_title,\n            new_file_content.len()\n        );\n\n        Ok(ToolResult::success(format!(\n            \"Section '{}' updated in {file} ({} bytes).\",\n            section_title,\n            new_file_content.len()\n        )))\n    }\n}\n\n/// Read file to string, returning an empty string when the file does not exist.\nasync fn read_or_empty(path: &std::path::Path) -> anyhow::Result<String> {\n    match tokio::fs::read_to_string(path).await {\n        Ok(s) => Ok(s),\n        Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(String::new()),\n        Err(e) => Err(anyhow::anyhow!(\"Failed to read {}: {e}\", path.display())),\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    fn make_tool(dir: &std::path::Path) -> UpdateMemoryMdTool {\n        UpdateMemoryMdTool::new(dir.to_path_buf())\n    }\n\n    #[tokio::test]\n    async fn append_creates_file_if_missing() {\n        let dir = tempfile::tempdir().unwrap();\n        let tool = make_tool(dir.path());\n        let result = tool\n            .execute(json!({\n                \"file\": \"MEMORY.md\",","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/tools/impl/filesystem/update_memory_md.rs#L386-L422","documentation":"The helper read_or_empty maps tokio::fs::read_to_string failures (other than not-found, which yields \"\") into this error — e.g. permission denied or an I/O error on MEMORY.md/SKILL.md. It means the existing file exists but could not be read, aborting the read-modify-write.","triggerScenarios":"Thrown at src/openhuman/tools/impl/filesystem/update_memory_md.rs:404 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check file permissions on the target MEMORY.md/SKILL.md and repair them","Rule out disk/FS errors; then retry the update"],"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-14T00:17:10.932Z"}