lima-vm/lima · error
field `disk` has an invalid value: %w
Error message
field `disk` has an invalid value: %w
What it means
Lima validates the `disk` field of LimaYAML during Validate(). The value must be a size string parseable by kballard/go-units RAMInBytes (e.g. "50GiB", "100G"). If parsing fails, this error is joined into the accumulated validation errors with the underlying parse error via %w.
Source
Thrown at pkg/limayaml/validate.go:115
if err != nil {
errs = errors.Join(errs, err)
}
if f.Initrd.Arch != f.Arch {
errs = errors.Join(errs, fmt.Errorf("images[%d].initrd has unexpected architecture %#q, must be %#q", i, f.Initrd.Arch, f.Arch))
}
}
}
if *y.CPUs == 0 {
errs = errors.Join(errs, errors.New("field `cpus` must be set"))
}
if _, err := units.RAMInBytes(*y.Memory); err != nil {
errs = errors.Join(errs, fmt.Errorf("field `memory` has an invalid value: %w", err))
}
if _, err := units.RAMInBytes(*y.Disk); err != nil {
errs = errors.Join(errs, fmt.Errorf("field `disk` has an invalid value: %w", err))
}
for i, disk := range y.AdditionalDisks {
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))
}View on GitHub (pinned to dd909d0973)
Solutions
- Fix the `disk:` value in lima.yaml to a valid size string such as `50GiB` or `100GB` (no space between number and unit)
- If set via CLI, quote/reformat the --set expression, e.g. `limactl edit --set 'disk: 60GiB' inst`
- Run `limactl template validate` on the file to confirm the fix before starting
Example fix
// before disk: 50 GB // after disk: 50GiB
Defensive patterns
Strategy: validation
Validate before calling
const sizeRe = /^\d+(\.\d+)?(KiB|MiB|GiB|TiB|kB|MB|GB|TB|B|K|M|G|T)?$/i
function validDiskSize(v) { return typeof v === 'string' && sizeRe.test(v.trim()) && !/\s/.test(v) }
// call before: validDiskSize(cfg.disk) Type guard
function isDiskSize(v) { return typeof v === 'string' && /^\d+(KiB|MiB|GiB|TiB|KB|MB|GB|TB|B)?$/i.test(v) } Try / catch
try { await limactl(['template','validate', file]) } catch (e) { if (/field `disk` has an invalid value/.test(e.message)) { fixDiskField(); } else throw e } Prevention
- Always attach units with no whitespace: 50GiB not "50 GB"
- Run `limactl template validate` after every manual edit
- Use `limactl edit --set` with tested values rather than free-text YAML edits
When it happens
Trigger: Calling limactl create/start/edit/restart/template validate/apply with a lima.yaml whose `disk:` value is not a valid byte-size string, e.g. `disk: 50 GB` (space), `disk: 50gb` variants unsupported by the parser, or a bare number with no unit.
Common situations: Hand-editing lima.yaml or using `limactl edit --set 'disk: 50 GB'`; copy-pasting sizes from docs of other tools; typos like `disk: 50Gi` vs `50GiB` depending on parser support.
Related errors
- invalid disk size %#q: %w
- currently Windows guest is only supported on [%#q, %#q]; got
- field `os` must be one of %#q; got %#q
- field `arch` must be one of %v; got %#q
- field `user.shell` must be one of %v for Windows guest, got
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/534187d796e770f8.
Report an issue: GitHub.