lima-vm/lima · error

field `mounts[%d].location` refers to an inaccessible path:

Error message

field `mounts[%d].location` refers to an inaccessible path: %#q: %w

What it means

Validate() calls os.Stat on the expanded `mounts[i].location`. If Stat fails for a reason other than os.ErrNotExist (e.g. permission denied on a parent directory, not a directory in the path, I/O error), this error wraps the OS error.

Source

Thrown at pkg/limayaml/validate.go:137

		if err := identifiers.Validate(disk.Name); err != nil {
			errs = errors.Join(errs, fmt.Errorf("field `additionalDisks[%d].name is invalid`: %w", i, err))
		}
	}

	for i, f := range y.Mounts {
		if !filepath.IsAbs(f.Location) && !strings.HasPrefix(f.Location, "~") {
			errs = errors.Join(errs, fmt.Errorf("field `mounts[%d].location` must be an absolute path, got %#q",
				i, f.Location))
		}
		// f.Location has already been expanded in FillDefaults(), but that function cannot return errors.
		loc, err := localpathutil.Expand(f.Location)
		if err != nil {
			errs = errors.Join(errs, fmt.Errorf("field `mounts[%d].location` refers to an unexpandable path: %#q: %w", i, f.Location, err))
		}
		st, err := os.Stat(loc)
		if err != nil {
			if !errors.Is(err, os.ErrNotExist) {
				errs = errors.Join(errs, fmt.Errorf("field `mounts[%d].location` refers to an inaccessible path: %#q: %w", i, f.Location, err))
			}
			if warn {
				logrus.Warnf("field `mounts[%d].location` refers to a non-existent directory: %#q:", i, f.Location)
			}
		} else if !st.IsDir() {
			errs = errors.Join(errs, fmt.Errorf("field `mounts[%d].location` refers to a non-directory path: %#q: %w", i, f.Location, err))
		}

		switch *f.MountPoint {
		case "/", "/bin", "/dev", "/etc", "/home", "/opt", "/sbin", "/tmp", "/usr", "/var":
			errs = errors.Join(errs, fmt.Errorf("field `mounts[%d].mountPoint` must not be a system path such as /etc or /usr", i))
		// home directory defined in "cidata.iso:/user-data"
		case *y.User.Home:
			errs = errors.Join(errs, fmt.Errorf("field `mounts[%d].mountPoint` is the reserved internal home directory %#q", i, *y.User.Home))
		}
		// There is no tilde-expansion for guest filenames
		if strings.HasPrefix(*f.MountPoint, "~") {
			errs = errors.Join(errs, fmt.Errorf("field `mounts[%d].mountPoint` must not start with `~`", i))

View on GitHub (pinned to dd909d0973)

Solutions

  1. Fix host permissions so the invoking user can traverse the path (chmod/chown, or grant disk access on macOS)
  2. Point the mount at a directory the user can read
  3. If the path no longer exists, remove or correct the mount entry (ErrNotExist is allowed, other errors are not)

Example fix

// before
mounts:
  - location: /var/lib/docker/volumes/myvol
// after
mounts:
  - location: ~/docker-volumes/myvol
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs')
function accessibleDir(loc) {
  const p = loc.startsWith('~') ? require('os').homedir() + loc.slice(1) : loc
  try { fs.accessSync(p, fs.constants.R_OK | fs.constants.X_OK); return true } catch { return false }
}

Try / catch

try { await limactl(['start', inst]) } catch (e) { if (/inaccessible path/.test(e.message)) { fixPermissionsOrRelocate(e.message); } else throw e }

Prevention

When it happens

Trigger: A mount location exists in name but is not stat-able: permission denied on a path component, a path component is actually a file, or filesystem errors, when Validate runs.

Common situations: Mounting a directory under a root-only path like `/var/lib/docker/...` from an unprivileged limactl run; pointing at a path inside an encrypted/fuse mount that errors; macOS TCC blocking access to ~/Library or Desktop.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/73816c9301c486c1. Report an issue: GitHub.