abiosoft/colima · error

error writing temporary file: %w

Error message

error writing temporary file: %w

What it means

Second error mode of waitForUserEdit: the freshly created temp file exists but tmp.Write(content) fails while writing the editor's initial content (abort header + current config/template). With the file already open and created, this is effectively always an I/O-level failure — ENOSPC (disk/quota full) or EIO on the temp filesystem.

Source

Thrown at cmd/util.go:34

func newApp() app.App {
	colimaApp, err := app.New()
	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{

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Free space on the temp volume and retry the edit command
  2. Check quotas if on a shared system: `quota -s` / `df -h "${TMPDIR:-/tmp}"`
  3. Redirect temp writes to another volume: `TMPDIR=$HOME/tmp colima start --edit`
  4. If EIO persists, suspect hardware/filesystem corruption on the temp mount
Defensive patterns

Strategy: retry

Validate before calling

// Cheap space check before editing large configs
var stat syscall.Statfs_t
if err := syscall.Statfs(os.TempDir(), &stat); err == nil {
    free := stat.Bavail * uint64(stat.Bsize)
    if free < 1<<20 { // < 1 MiB
        log.Fatal("temp filesystem nearly full; free space before editing")
    }
}

Try / catch

if err := startCmd.Execute(); err != nil {
    var perr *fs.PathError
    if errors.As(err, &perr) && errors.Is(perr.Err, syscall.ENOSPC) {
        // free space on the temp volume and retry once
    }
}

Prevention

When it happens

Trigger: Disk filling exactly between CreateTemp and Write; per-user quota exceeded on the volume hosting TMPDIR; failing/USB-backed temp filesystem returning EIO.

Common situations: macOS low-disk warnings ignored; Docker/CI runners with small tmpfs quotas; large config plus nearly-full disk.

Related errors


AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15). Data as JSON: /api/errors/ba16344a2aa63013. Report an issue: GitHub.