multica-ai/multica · error
write temp for %s: %w
Error message
write temp for %s: %w
What it means
writeFileAtomic created the temp file but the initial Write of the payload failed. The data (derived config.yaml, marker, etc.) never made it to disk fully, so the atomic replace is abandoned and the temp file cleaned up by the deferred Remove.
Source
Thrown at server/internal/daemon/execenv/hermes_home.go:923
return fmt.Errorf("marshal hermes config: %w", err)
}
return writeFileAtomic(dst, out, 0o600)
}
// writeFileAtomic writes data to a temp file in the destination directory with
// the given perms, then renames it over dst — so readers never see a partial
// file and a prior file's looser permissions are replaced.
func writeFileAtomic(dst string, data []byte, perm os.FileMode) error {
dir := filepath.Dir(dst)
tmp, err := os.CreateTemp(dir, ".hermes-tmp-*")
if err != nil {
return fmt.Errorf("create temp for %s: %w", dst, err)
}
tmpName := tmp.Name()
defer os.Remove(tmpName) // no-op once renamed
if _, err := tmp.Write(data); err != nil {
tmp.Close()
return fmt.Errorf("write temp for %s: %w", dst, err)
}
if err := tmp.Chmod(perm); err != nil {
tmp.Close()
return fmt.Errorf("chmod temp for %s: %w", dst, err)
}
if err := tmp.Close(); err != nil {
return fmt.Errorf("close temp for %s: %w", dst, err)
}
if err := os.Rename(tmpName, dst); err != nil {
return fmt.Errorf("rename temp to %s: %w", dst, err)
}
return nil
}
View on GitHub (pinned to 2c0912b6ec)
Solutions
- Free disk space / raise quota on the destination volume and retry.
- For network volumes, check mount health (`nfsstat`, dmesg) and prefer local disk for env RootDir.
- Exclude the env root from AV real-time scanning on Windows.
- Retry the task — transient write failures clear once the underlying condition is fixed.
Defensive patterns
Strategy: retry
Validate before calling
if free, err := statFreeSpace(filepath.Dir(dst)); err == nil && free < int64(len(data))+1<<20 {
return fmt.Errorf("insufficient space for %s: need ~%d bytes", dst, int64(len(data)))
} Try / catch
err := writeFileAtomic(dst, data, perm)
if err != nil && strings.Contains(err.Error(), "write temp") {
// ENOSPC/EDQUOT mid-write is often transient after cleanup — retry once
time.Sleep(100 * time.Millisecond)
err = writeFileAtomic(dst, data, perm)
}
return err Prevention
- Keep headroom on the env volume; reserve space for temp-file writes.
- For NFS/SMB destinations, prefer local scratch disks when reliability matters.
When it happens
Trigger: ENOSPC/EDQUOT hit mid-write; write timeout or I/O error on network-attached storage; file closed out from under the process by AV quarantine on Windows.
Common situations: Disk exactly full enough to create a temp file but not hold the payload; NFS/SMB jitter; security software intercepting writes of files that contain api_key-like secrets.
Related errors
- create temp for %s: %w
- close temp for %s: %w
- runtime local skill import timed out
- write temp file: %w
- copy %s %s to %s: %w
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/e95cf70351199503.
Report an issue: GitHub.