abiosoft/colima · error
error closing temporary file: %w
Error message
error closing temporary file: %w
What it means
Third error mode of waitForUserEdit: tmp.Close() fails while flushing/closing the temp file after writing. On local filesystems a close error usually means the final flush of buffered data hit ENOSPC or a device-level EIO; on network filesystems it can also surface locking/state errors. The file handle is left in an unknown state and the edit flow aborts.
Source
Thrown at cmd/util.go:37
if err != nil {
logrus.Fatal("Error: ", err)
}
return colimaApp
}
// waitForUserEdit launches a temporary file with content using editor,
// and waits for the user to close the editor.
// It returns the filename (if saved), empty file name (if aborted), and an error (if any).
func waitForUserEdit(editor string, content []byte) (string, error) {
tmp, err := os.CreateTemp("", "colima-*.yaml")
if err != nil {
return "", fmt.Errorf("error creating temporary file: %w", err)
}
if _, err := tmp.Write(content); err != nil {
return "", fmt.Errorf("error writing temporary file: %w", err)
}
if err := tmp.Close(); err != nil {
return "", fmt.Errorf("error closing temporary file: %w", err)
}
if err := launchEditor(editor, tmp.Name()); err != nil {
return "", err
}
// aborted
if f, err := os.ReadFile(tmp.Name()); err == nil && len(bytes.TrimSpace(f)) == 0 {
return "", nil
}
return tmp.Name(), nil
}
var editors = []string{
"vim",
"code --wait --new-window",
"nano",View on GitHub (pinned to c3a5f9184d)
Solutions
- Free space on the temp volume (`df -h "${TMPDIR:-/tmp}"`) and retry
- Move TMPDIR to a healthy local volume: `TMPDIR=$HOME/tmp colima start --edit`
- If TMPDIR is a network/FUSE mount, stop pointing TMPDIR at it for interactive edits
- Repeated EIO on a local disk indicates filesystem/hardware trouble — check with `dmesg`/Disk Utility
Defensive patterns
Strategy: retry
Try / catch
if err := startCmd.Execute(); err != nil {
var perr *fs.PathError
if errors.As(err, &perr) {
switch {
case errors.Is(perr.Err, syscall.ENOSPC):
// flush failed at close: free space, retry
case errors.Is(perr.Err, syscall.EIO):
// backing filesystem error: switch TMPDIR to a local volume, retry
}
}
} Prevention
- Prefer a local disk for TMPDIR; close-time EIO is typical of NFS/FUSE temp mounts
- Free disk space before editing when the volume is near capacity
- Recurring EIO on local disks warrants filesystem/hardware checks, not retries
When it happens
Trigger: Writing content that fits in the buffer but cannot be flushed at close because the disk/quota filled; TMPDIR on NFS/FUSE with close-time errors; removable media yanked mid-flow.
Common situations: Disk-full conditions detected only at close; TMPDIR pointed at a network share in corporate setups; flaky USB drives hosting /tmp.
Related errors
- error writing temporary file: %w
- error creating temporary file: %w
- cannot seek to start of file: %w
- error reading file for SHA validation: %w
- error getting terminal size: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/3e3b3a3cb587a28b.
Report an issue: GitHub.