{"record":{"id":"621625e7abe22a0b","repo":"tinyhumansai/openhuman","slug":"failed-to-stage-temp-file-for-file-e","errorCode":null,"errorMessage":"Failed to stage temp file for {file}: {e}","messagePattern":"Failed to stage temp file for (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/tools/impl/filesystem/update_memory_md.rs","lineNumber":122,"sourceCode":"    let dir = path\n        .parent()\n        .ok_or_else(|| anyhow::anyhow!(\"target path has no parent directory\"))?;\n    let seq = TEMP_FILE_SEQ.fetch_add(1, Ordering::Relaxed);\n    let tmp_name = format!(\".{file}.{}.{seq}.tmp\", std::process::id());\n    let tmp_path = dir.join(tmp_name);\n\n    tracing::debug!(\n        tmp = %tmp_path.display(),\n        target = %path.display(),\n        bytes = content.len(),\n        \"[update_memory_md] atomic write: staging temp file\"\n    );\n\n    if let Err(e) = tokio::fs::write(&tmp_path, content).await {\n        // Clean up a partially-written temp file so a failed stage doesn't\n        // litter the workspace (CodeRabbit: temp not cleaned on initial write).\n        let _ = tokio::fs::remove_file(&tmp_path).await;\n        return Err(anyhow::anyhow!(\"Failed to stage temp file for {file}: {e}\"));\n    }\n\n    if let Err(e) = tokio::fs::rename(&tmp_path, path).await {\n        // Best-effort cleanup so a failed rename doesn't litter the workspace.\n        let _ = tokio::fs::remove_file(&tmp_path).await;\n        return Err(anyhow::anyhow!(\"Failed to atomically write {file}: {e}\"));\n    }\n\n    tracing::debug!(\n        target = %path.display(),\n        \"[update_memory_md] atomic write: rename committed\"\n    );\n    Ok(())\n}\n\n/// Appends or replaces a named section in MEMORY.md or SKILL.md.\n///\n/// Supports two actions:","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/tools/impl/filesystem/update_memory_md.rs#L104-L140","documentation":"Writing the sibling temp file (.{file}.{pid}.{seq}.tmp) for the atomic replace of MEMORY.md failed with the filesystem error {e}. The original file is untouched — the tool cleans up the partial temp file and aborts before the rename.","triggerScenarios":"Thrown at src/openhuman/tools/impl/filesystem/update_memory_md.rs:122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read {e} for the OS cause (disk full, permissions)","Free space or fix permissions in the workspace directory","Retry once the underlying condition is cleared"],"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"}