{"record":{"id":"596840443948e4dd","repo":"lima-vm/lima","slug":"field-additionaldisks-d-name-is-invalid-w","errorCode":null,"errorMessage":"field `additionalDisks[%d].name is invalid`: %w","messagePattern":"field `additionalDisks\\[(.+?)\\]\\.name is invalid`: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/limayaml/validate.go","lineNumber":120,"sourceCode":"\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}\n\t\tst, err := os.Stat(loc)\n\t\tif err != nil {\n\t\t\tif !errors.Is(err, os.ErrNotExist) {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `mounts[%d].location` refers to an inaccessible path: %#q: %w\", i, f.Location, err))\n\t\t\t}","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/limayaml/validate.go#L102-L138","documentation":"Each entry of `additionalDisks` must have a name that passes identifiers.Validate (a valid disk identifier). When a disk name is empty or contains invalid characters, this error is joined into the validation error list with the underlying reason.","triggerScenarios":"Validate() is called (create/start/edit/restart/apply/template validate/templateArgs) with lima.yaml containing an additionalDisks entry whose `name` is empty, contains invalid characters, or is otherwise not an accepted identifier.","commonSituations":"Referencing an additional disk created via `limactl disk create` but mistyping its name; leaving `name:` blank; using names with slashes/spaces from copied YAML.","solutions":["Set a valid `name` for every additionalDisks entry (letters, digits, dashes; non-empty)","Create the disk first if it does not exist: `limactl disk create NAME --size 10GiB`","Re-run `limactl template validate <file>` to confirm all additionalDisks names pass"],"exampleFix":"// before\nadditionalDisks:\n  - name: my disk/1\n// after\nadditionalDisks:\n  - name: my-disk-1","handlingStrategy":"validation","validationCode":"function validDiskName(n) { return typeof n === 'string' && /^[A-Za-z0-9][A-Za-z0-9_.-]*$/.test(n) }\n// check every entry: (cfg.additionalDisks||[]).every(d => validDiskName(d.name))","typeGuard":"function isNamedDisk(d) { return d != null && typeof d.name === 'string' && d.name.length > 0 && /^[A-Za-z0-9_-]+$/.test(d.name) }","tryCatchPattern":"try { await limactl(['template','validate', file]) } catch (e) { const m = e.message.match(/additionalDisks\\[(\\d+)\\]\\.name/); if (m) { renameDisk(+m[1]); } else throw e }","preventionTips":["Create disks with `limactl disk create` and reuse the exact name","Avoid spaces and slashes in disk names","Validate templates before distributing them to teams"],"tags":["lima","config-validation","disk"],"backgroundTag":"invalid-identifier","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}