abiosoft/colima · error

cannot make dir: %w

Error message

cannot make dir: %w

What it means

Returned by daemonize (cmd/daemon/daemon.go:27) when fsutil.MkdirAll on the daemon's working directory (process.Dir(), home of daemon.pid and daemon.log) fails before the daemon can fork. The %w carries the underlying filesystem error.

Source

Thrown at cmd/daemon/daemon.go:27

	"strconv"
	"sync"
	"syscall"
	"time"

	"github.com/abiosoft/colima/cli"
	"github.com/abiosoft/colima/daemon/process"
	"github.com/abiosoft/colima/util/fsutil"
	godaemon "github.com/sevlyar/go-daemon"
	"github.com/sirupsen/logrus"
)

var dir = process.Dir

// daemonize creates the daemon and returns if this is a child process
func daemonize() (ctx *godaemon.Context, child bool, err error) {
	dir := dir()
	if err := fsutil.MkdirAll(dir, 0755); err != nil {
		return nil, false, fmt.Errorf("cannot make dir: %w", err)
	}

	info := Info()

	ctx = &godaemon.Context{
		PidFileName: info.PidFile,
		PidFilePerm: 0644,
		LogFileName: info.LogFile,
		LogFilePerm: 0644,
	}

	d, err := ctx.Reborn()
	if err != nil {
		return ctx, false, fmt.Errorf("error starting daemon: %w", err)
	}
	if d != nil {
		return ctx, false, nil
	}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Create the directory manually to surface the real cause: `mkdir -p <daemon-dir>`
  2. Fix ownership of the colima home: `sudo chown -R $(id -un) ~/.colima`
  3. Ensure HOME is set correctly in launchd/cron/CI environments invoking colima
  4. Remove any regular file occupying the directory path
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight: ensure the daemon dir can be created before daemonize()
if err := fsutil.MkdirAll(process.Dir(), 0755); err != nil {
    return fmt.Errorf("daemon dir not preparable: %w", err)
}

Prevention

When it happens

Trigger: The daemon directory cannot be created: its parent (under the colima home) is not writable, a regular file occupies a component of the path, HOME is unset or points somewhere unwritable (launchd/cron contexts), or the volume is read-only/full.

Common situations: Running colima from automation where HOME is not set; ~/.colima (or the daemon subdir) was created by root previously; sandboxed/read-only home directories.

Related errors


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