abiosoft/colima · error

error sanitising mount path for inotify: %w

Error message

error sanitising mount path for inotify: %w

What it means

When MountINotify is enabled, daemon Start appends --inotify-dir for every mount in conf.MountsOrDefault(). Each mount Location passes through util.CleanPath, which expands environment variables, expands a leading ~, then rejects anything not absolute with 'relative paths not supported for mount ...'. This wrapper is returned when any mount location fails that check, aborting daemon start before the inotify process is launched.

Source

Thrown at daemon/daemon.go:113

	if err := l.init(); err != nil {
		return fmt.Errorf("error preparing daemon directory: %w", err)
	}

	args := []string{osutil.Executable(), "daemon", "start", config.CurrentProfile().ShortName}

	if conf.Network.Address {
		args = append(args, "--vmnet")
		args = append(args, "--vmnet-mode", conf.Network.Mode)
		args = append(args, "--vmnet-interface", conf.Network.BridgeInterface)
	}
	if conf.MountINotify {
		args = append(args, "--inotify")
		args = append(args, "--inotify-runtime", conf.Runtime)
		for _, mount := range conf.MountsOrDefault() {
			p, err := util.CleanPath(mount.Location)
			if err != nil {
				return fmt.Errorf("error sanitising mount path for inotify: %w", err)
			}
			args = append(args, "--inotify-dir", p)
		}
	}

	if cli.Settings.Verbose {
		args = append(args, "--very-verbose")
	}

	host := l.host.WithDir(util.HomeDir())
	return host.RunQuiet(args...)
}
func (l processManager) Stop(ctx context.Context, conf config.Config) error {
	if s, err := l.Running(ctx, conf); err != nil || !s.Running {
		return nil
	}
	return l.host.RunQuiet(osutil.Executable(), "daemon", "stop", config.CurrentProfile().ShortName)
}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. edit the config (`colima start --edit`) and make every mount location absolute (e.g. /Users/me/project)
  2. verify any env vars used in mount locations resolve to absolute paths where colima runs
  3. restart colima after fixing the config

Example fix

# before (colima.yaml)
mounts:
  - location: "src"          # relative -> error sanitising mount path for inotify

# after
mounts:
  - location: "/Users/me/project/src"
Defensive patterns

Strategy: validation

Validate before calling

for _, m := range conf.MountsOrDefault() {
    if _, err := util.CleanPath(m.Location); err != nil {
        return fmt.Errorf("mount %q invalid: %w — use an absolute path", m.Location, err)
    }
}
// cheaper inline check: filepath.IsAbs after expanding $VARS and ~

Try / catch

if err := manager.Start(ctx, conf); err != nil {
    var ipErr *util.RelativePathError // if CleanPath ever exports a typed error
    if errors.As(err, &ipErr) {
        // point the user at ipErr.Location in their colima.yaml
    }
}

Prevention

When it happens

Trigger: a hand-edited colima.yaml with a relative location like "src" or "./project"; an env-var-based mount whose variable expands to a relative path in the daemon's environment; starting with --mount-inotify while such a mount exists (without inotify the path is never sanitized here).

Common situations: configs authored on Linux tools that accept cwd-relative bind paths; templates assuming the shell's cwd; variables like $REPO defined in the interactive shell but absent from the daemon environment.

Related errors


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