{"record":{"id":"534187d796e770f8","repo":"lima-vm/lima","slug":"field-disk-has-an-invalid-value-w","errorCode":null,"errorMessage":"field `disk` has an invalid value: %w","messagePattern":"field `disk` has an invalid value: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/limayaml/validate.go","lineNumber":115,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\terrs = errors.Join(errs, err)\n\t\t\t}\n\t\t\tif f.Initrd.Arch != f.Arch {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"images[%d].initrd has unexpected architecture %#q, must be %#q\", i, f.Initrd.Arch, f.Arch))\n\t\t\t}\n\t\t}\n\t}\n\n\tif *y.CPUs == 0 {\n\t\terrs = errors.Join(errs, errors.New(\"field `cpus` must be set\"))\n\t}\n\n\tif _, err := units.RAMInBytes(*y.Memory); err != nil {\n\t\terrs = errors.Join(errs, fmt.Errorf(\"field `memory` has an invalid value: %w\", err))\n\t}\n\n\tif _, err := units.RAMInBytes(*y.Disk); err != nil {\n\t\terrs = errors.Join(errs, fmt.Errorf(\"field `disk` has an invalid value: %w\", err))\n\t}\n\n\tfor i, disk := range y.AdditionalDisks {\n\t\tif err := identifiers.Validate(disk.Name); err != nil {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `additionalDisks[%d].name is invalid`: %w\", i, err))\n\t\t}\n\t}\n\n\tfor i, f := range y.Mounts {\n\t\tif !filepath.IsAbs(f.Location) && !strings.HasPrefix(f.Location, \"~\") {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `mounts[%d].location` must be an absolute path, got %#q\",\n\t\t\t\ti, f.Location))\n\t\t}\n\t\t// f.Location has already been expanded in FillDefaults(), but that function cannot return errors.\n\t\tloc, err := localpathutil.Expand(f.Location)\n\t\tif err != nil {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `mounts[%d].location` refers to an unexpandable path: %#q: %w\", i, f.Location, err))\n\t\t}","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/limayaml/validate.go#L97-L133","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ndisk: 50 GB\n// after\ndisk: 50GiB","handlingStrategy":"validation","validationCode":"const sizeRe = /^\\d+(\\.\\d+)?(KiB|MiB|GiB|TiB|kB|MB|GB|TB|B|K|M|G|T)?$/i\nfunction validDiskSize(v) { return typeof v === 'string' && sizeRe.test(v.trim()) && !/\\s/.test(v) }\n// call before: validDiskSize(cfg.disk)","typeGuard":"function isDiskSize(v) { return typeof v === 'string' && /^\\d+(KiB|MiB|GiB|TiB|KB|MB|GB|TB|B)?$/i.test(v) }","tryCatchPattern":"try { await limactl(['template','validate', file]) } catch (e) { if (/field `disk` has an invalid value/.test(e.message)) { fixDiskField(); } else throw e }","preventionTips":["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"],"tags":["lima","config-validation","disk-size"],"backgroundTag":"invalid-size-string","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}