abiosoft/colima · error
error writing temp file: %w
Error message
error writing temp file: %w
What it means
Immediately after creating the temp file, vmnetFile.Install writes the embedded tarball bytes with f.Write(gz); failure wraps as 'error writing temp file'. Nearly always storage exhaustion mid-write: disk full or quota exceeded between CreateTemp and Write, tmpfs size limits, or the file having been closed/removed externally. The deferred os.Remove cleans up the partial file.
Source
Thrown at daemon/process/vmnet/deps.go:64
func (v vmnetFile) Install(host environment.HostActions) error {
arch := "x86_64"
if runtime.GOARCH != "amd64" {
arch = "arm64"
}
// read the embedded file
gz, err := embedded.Read("network/vmnet_" + arch + ".tar.gz")
if err != nil {
return fmt.Errorf("error retrieving embedded vmnet file: %w", err)
}
// write tar to tmp directory
f, err := os.CreateTemp("", "vmnet.tar.gz")
if err != nil {
return fmt.Errorf("error creating temp file: %w", err)
}
if _, err := f.Write(gz); err != nil {
return fmt.Errorf("error writing temp file: %w", err)
}
_ = f.Close() // not a fatal error
defer func() {
_ = os.Remove(f.Name())
}()
// extract tar to desired location
dir := optDir
if err := host.RunInteractive("sudo", "mkdir", "-p", dir); err != nil {
return fmt.Errorf("error preparing colima privileged dir: %w", err)
}
if err := host.RunInteractive("sudo", "sh", "-c", fmt.Sprintf("cd %s && tar xfz %s 2>/dev/null", dir, f.Name())); err != nil {
return fmt.Errorf("error extracting vmnet archive: %w", err)
}
return nil
}View on GitHub (pinned to c3a5f9184d)
Solutions
- check free space where TMPDIR lives: df -h $TMPDIR, then clean up
- point TMPDIR at a larger writable filesystem and retry
- retry the start once space is available — the partial temp file is auto-removed by the deferred cleanup
Defensive patterns
Strategy: try-catch
Validate before calling
var stat syscall.Statfs_t
if err := syscall.Statfs(os.TempDir(), &stat); err == nil {
free := stat.Bavail * uint64(stat.Bsize)
if free < 50<<20 { // tarball is a few MB; require headroom
return fmt.Errorf("less than 50MB free in %s — free space first", os.TempDir())
}
} Try / catch
if _, err := f.Write(gz); err != nil {
_ = f.Close()
_ = os.Remove(f.Name()) // partial file cleanup; ENOSPC: free space then retry install
return fmt.Errorf("error writing temp file: %w", err)
} Prevention
- keep headroom on the temp filesystem when using --network-address
- prefer a disk-backed TMPDIR over small tmpfs for privileged installs
- retry the vmnet install after freeing space — Install is idempotent
When it happens
Trigger: disk fills between temp file creation and the multi-megabyte write; TMPDIR on a small tmpfs smaller than the vmnet tarball; file descriptors/quotas exhausted.
Common situations: machines nearly out of disk; CI containers with hard tmp size limits.
Related errors
- error creating temp file: %w
- error preparing colima privileged dir: %w
- failed to create bundle directory: %w
- cannot create file '%s': %w
- error persisting runtime settings: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/8a0b84fd77378c88.
Report an issue: GitHub.