tinyhumansai/openhuman · error
Failed to atomically write {file}: {e}
Error message
Failed to atomically write {file}: {e} What it means
The final rename of the staged temp file over the target failed with the OS error {e}, breaking the atomic replace. The temp file was written successfully but the swap did not happen; the target still holds its previous (complete) contents.
Source
Thrown at src/openhuman/tools/impl/filesystem/update_memory_md.rs:128
tracing::debug!(
tmp = %tmp_path.display(),
target = %path.display(),
bytes = content.len(),
"[update_memory_md] atomic write: staging temp file"
);
if let Err(e) = tokio::fs::write(&tmp_path, content).await {
// Clean up a partially-written temp file so a failed stage doesn't
// litter the workspace (CodeRabbit: temp not cleaned on initial write).
let _ = tokio::fs::remove_file(&tmp_path).await;
return Err(anyhow::anyhow!("Failed to stage temp file for {file}: {e}"));
}
if let Err(e) = tokio::fs::rename(&tmp_path, path).await {
// Best-effort cleanup so a failed rename doesn't litter the workspace.
let _ = tokio::fs::remove_file(&tmp_path).await;
return Err(anyhow::anyhow!("Failed to atomically write {file}: {e}"));
}
tracing::debug!(
target = %path.display(),
"[update_memory_md] atomic write: rename committed"
);
Ok(())
}
/// Appends or replaces a named section in MEMORY.md or SKILL.md.
///
/// Supports two actions:
/// - `append`: adds `content` to the end of the file.
/// - `replace_section`: locates the first `## {section_title}` heading and
/// replaces the body (lines until the next `##` heading or EOF) with `content`.
pub struct UpdateMemoryMdTool {
workspace_dir: PathBuf,
}View on GitHub (pinned to 7491200858)
Solutions
- Read {e}: cross-device errors mean the temp file left the target's filesystem
- Check permissions on the target file/directory
- Retry after resolving; leftover .tmp siblings are safe to remove
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src/openhuman/tools/impl/filesystem/update_memory_md.rs:128 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17).
Data as JSON: /api/errors/076dcb26f3a85117.
Report an issue: GitHub.