{"record":{"id":"e9a1a288c6a4ba20","repo":"lima-vm/lima","slug":"field-mounts-d-mountpoint-must-not-start-with","errorCode":null,"errorMessage":"field `mounts[%d].mountPoint` must not start with `~`","messagePattern":"field `mounts\\[(.+?)\\]\\.mountPoint` must not start with `~`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/limayaml/validate.go","lineNumber":155,"sourceCode":"\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}\n\t\t\tif warn {\n\t\t\t\tlogrus.Warnf(\"field `mounts[%d].location` refers to a non-existent directory: %#q:\", i, f.Location)\n\t\t\t}\n\t\t} else if !st.IsDir() {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `mounts[%d].location` refers to a non-directory path: %#q: %w\", i, f.Location, err))\n\t\t}\n\n\t\tswitch *f.MountPoint {\n\t\tcase \"/\", \"/bin\", \"/dev\", \"/etc\", \"/home\", \"/opt\", \"/sbin\", \"/tmp\", \"/usr\", \"/var\":\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `mounts[%d].mountPoint` must not be a system path such as /etc or /usr\", i))\n\t\t// home directory defined in \"cidata.iso:/user-data\"\n\t\tcase *y.User.Home:\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `mounts[%d].mountPoint` is the reserved internal home directory %#q\", i, *y.User.Home))\n\t\t}\n\t\t// There is no tilde-expansion for guest filenames\n\t\tif strings.HasPrefix(*f.MountPoint, \"~\") {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `mounts[%d].mountPoint` must not start with `~`\", i))\n\t\t}\n\n\t\tif _, err := units.RAMInBytes(*f.NineP.Msize); err != nil {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `msize` has an invalid value: %w\", err))\n\t\t}\n\t}\n\n\tif *y.SSH.LocalPort != 0 {\n\t\tif err := validatePort(\"ssh.localPort\", *y.SSH.LocalPort); err != nil {\n\t\t\terrs = errors.Join(errs, err)\n\t\t}\n\t}\n\n\tif y.MountType != nil {\n\t\tswitch *y.MountType {\n\t\tcase limatype.REVSSHFS, limatype.NINEP, limatype.VIRTIOFS, limatype.WSLMount:\n\t\tdefault:\n\t\t\terrs = 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))","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/limayaml/validate.go#L137-L173","documentation":"The mountPoint field starts with `~`. Guest home expansion is not performed for mount points, so a literal tilde-prefixed path would be created inside the guest; use an absolute path instead.","triggerScenarios":"A mounts entry has `mountPoint: ~/data` or similar when Validate runs.","commonSituations":"Assuming both location and mountPoint support `~`; copying the location's tilde syntax into mountPoint; older configs written for tools that expanded guest tildes.","solutions":["Replace the tilde with the absolute guest home path, e.g. `/home/<user>.linux/data`","Or use a non-home path like `/mnt/host-data`","Re-validate with `limactl template validate`"],"exampleFix":"// before\nmounts:\n  - location: ~/data\n    mountPoint: ~/data\n// after\nmounts:\n  - location: ~/data\n    mountPoint: /home/user.linux/data","handlingStrategy":"validation","validationCode":"function noTildeInMountPoint(mp) { return typeof mp === 'string' && !mp.startsWith('~') }","typeGuard":"function isGuestAbsolutePath(mp) { return typeof mp === 'string' && mp.startsWith('/') }","tryCatchPattern":"try { await limactl(['template','validate', file]) } catch (e) { if (/mountPoint.*must not start with `~`/.test(e.message)) { replaceTildeWithGuestHome(); } else throw e }","preventionTips":["Remember: tilde expansion is host-only (location), never guest-side (mountPoint)","Use the explicit guest home path /home/<user>.linux when needed","Grep templates for `mountPoint: ~` in CI"],"tags":["lima","config-validation","mounts","path"],"backgroundTag":"tilde-in-guest-path","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}