lima-vm/lima · error

field `msize` has an invalid value: %w

Error message

field `msize` has an invalid value: %w

What it means

For each mount, the 9p `msize` option must be a valid byte-size string parseable by units.RAMInBytes (e.g. "128KiB", "1M"). An unparseable value is joined into the validation errors wrapped with this message. The field name is reported as bare `msize` even though it lives at mounts[i].ninep.msize.

Source

Thrown at pkg/limayaml/validate.go:159

			}
		} 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))
		}

		if _, err := units.RAMInBytes(*f.NineP.Msize); err != nil {
			errs = errors.Join(errs, fmt.Errorf("field `msize` has an invalid value: %w", err))
		}
	}

	if *y.SSH.LocalPort != 0 {
		if err := validatePort("ssh.localPort", *y.SSH.LocalPort); err != nil {
			errs = errors.Join(errs, err)
		}
	}

	if y.MountType != nil {
		switch *y.MountType {
		case limatype.REVSSHFS, limatype.NINEP, limatype.VIRTIOFS, limatype.WSLMount:
		default:
			errs = errors.Join(errs, fmt.Errorf("field `mountType` must be %#q or %#q or %#q, or %#q, got %#q", limatype.REVSSHFS, limatype.NINEP, limatype.VIRTIOFS, limatype.WSLMount, *y.MountType))
		}

		if slices.Contains(y.MountTypesUnsupported, *y.MountType) {
			errs = errors.Join(errs, fmt.Errorf("field `mountType` must not be one of %v (`mountTypesUnsupported`), got %#q", y.MountTypesUnsupported, *y.MountType))

View on GitHub (pinned to dd909d0973)

Solutions

  1. Set ninep.msize to a valid size string such as `128KiB` (common recommendation is 128KiB or 1MiB)
  2. Remove the msize field entirely to use the default
  3. Re-run `limactl template validate` to confirm

Example fix

// before
mounts:
  - location: ~/data
    ninep:
      msize: 128 KB
// after
mounts:
  - location: ~/data
    ninep:
      msize: 128KiB
Defensive patterns

Strategy: validation

Validate before calling

const sizeRe = /^\d+(\.\d+)?(KiB|MiB|GiB|B|K|M|G)?$/i
function validMsize(v) { return v === undefined || (typeof v === 'string' && sizeRe.test(v) && !/\s/.test(v)) }

Type guard

function isByteSize(v) { return typeof v === 'string' && /^\d+(KiB|MiB|GiB|KB|MB|GB|B|K|M|G)?$/i.test(v) }

Try / catch

try { await limactl(['template','validate', file]) } catch (e) { if (/field `msize` has an invalid value/.test(e.message)) { fixOrRemoveMsize(); } else throw e }

Prevention

When it happens

Trigger: A mounts entry sets ninep.msize to an invalid string (e.g. `msize: 128 KB` with a space, or a non-numeric token) when Validate runs.

Common situations: Tuning 9p performance and copying an msize with wrong formatting from docs/blogs; using `512k` vs `512KiB` inconsistently; leaving placeholder text like `msize: <size>` in a template.

Related errors


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