multica-ai/multica · error
close temp for %s: %w
Error message
close temp for %s: %w
What it means
writeFileAtomic could not Close the temp file after write+chmod. On local disks Close rarely fails; on network filesystems it is where delayed write errors (ENOSPC, EIO, commit failures) surface, so the helper treats a failed close as a failed write and never renames a suspect file into place.
Source
Thrown at server/internal/daemon/execenv/hermes_home.go:930
// 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
- Check storage health and free space; for NFS look for 'commit failed' / EIO in dmesg.
- Stabilize or remount the network share, then retry the task.
- Prefer local volumes for env RootDir to avoid close-time write semantics entirely.
- If it recurs on one file, inspect that path for a corrupted directory entry.
Defensive patterns
Strategy: retry
Try / catch
err := writeFileAtomic(dst, data, perm)
if err != nil && strings.Contains(err.Error(), "close temp") {
// network FS may report delayed write errors at close — single retry after a beat
time.Sleep(250 * time.Millisecond)
err = writeFileAtomic(dst, data, perm)
}
return err Prevention
- Monitor NFS commit failures (nfsstat, dmesg) when env roots live on NFS.
- Treat close-time errors as write failures — never consume a file whose temp close failed.
When it happens
Trigger: NFS async-write commit failure at close; ENOSPC reported only at flush; SMB disconnect mid-operation; filesystem gone read-only between write and close.
Common situations: Env RootDir on NFS/SMB shares under load or after a network blip; thinly-provisioned volume running out of space at commit time.
Related errors
- write temp for %s: %w
- runtime local skill import timed out
- create temp for %s: %w
- chmod temp for %s: %w
- rename temp to %s: %w
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/609a62a6cc16c50e.
Report an issue: GitHub.