{"record":{"id":"dbe49b88473fc0ac","repo":"abiosoft/colima","slug":"overlapping-mounts-not-supported-w","errorCode":null,"errorMessage":"overlapping mounts not supported: %w","messagePattern":"overlapping mounts not supported: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"environment/vm/lima/yaml.go","lineNumber":387,"sourceCode":"\t\t})\n\t}\n\n\t// grow partition in case disk size has increased\n\tl.Provision = append(l.Provision, limaconfig.Provision{\n\t\tMode:   limaconfig.ProvisionModeSystem,\n\t\tScript: \"resize2fs \" + diskByLabelPath(config.CurrentProfile().ID) + \" || true\",\n\t})\n\n\t/* end */\n\n\tif conf.Mounts != nil && len(conf.Mounts) == 0 {\n\t\tl.Mounts = append(l.Mounts,\n\t\t\tlimaconfig.Mount{Location: \"~\", Writable: true},\n\t\t)\n\t} else {\n\t\t// overlapping mounts are problematic in Lima https://github.com/lima-vm/lima/issues/302\n\t\tif err = checkOverlappingMounts(conf.Mounts); err != nil {\n\t\t\terr = fmt.Errorf(\"overlapping mounts not supported: %w\", err)\n\t\t\treturn\n\t\t}\n\n\t\tfor _, m := range conf.Mounts {\n\t\t\tvar location, mountPoint string\n\t\t\tlocation, err = util.CleanPath(m.Location)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tmountPoint, err = util.CleanPath(m.MountPoint)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tmount := limaconfig.Mount{Location: location, MountPoint: mountPoint, Writable: m.Writable}\n\n\t\t\tl.Mounts = append(l.Mounts, mount)\n\t\t}","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/vm/lima/yaml.go#L369-L405","documentation":"Error from checkOverlappingMounts during Lima config generation: two mounts' cleaned paths prefix each other (strings.HasPrefix both ways), which Lima cannot handle (lima-vm/lima#302). It fires only when conf.Mounts is non-empty; an empty/nil slice gets the default '~' writable mount instead.","triggerScenarios":"Passing mounts where one location/mount point is a path prefix of another: '~' together with '~/projects', '/Users/me' with '/Users/me/src', or a mountPoint nested under another mount's mountPoint.","commonSituations":"'colima start --mount ~/src --mount ~/src/subdir' for IDE convenience; adding a deeper writable mount on top of a read-only parent mount; migrating docker-machine/VirtualBox style nested shares.","solutions":["Drop the redundant ancestor mount and keep only the deepest path you need","Reorder your intent: mount the common parent once with the desired writability instead of layering children","If you only want the home directory, pass no --mount at all — colima defaults to mounting '~' writable","Ensure paths are cleaned/absolute so '~/foo' and '/Users/x/foo' are not accidentally compared as distinct"],"exampleFix":"# before\ncolima start --mount ~/src:ro --mount ~/src/writable\n# after: single mount, adjust writability at the parent\ncolima start --mount ~/src","handlingStrategy":"validation","validationCode":"// mirror checkOverlappingMounts before start\nfunc mountsOverlap(mounts []config.Mount) bool {\n    paths := make([]string, 0, len(mounts))\n    for _, m := range mounts {\n        p, _ := util.CleanPath(firstNonEmpty(m.MountPoint, m.Location))\n        paths = append(paths, p)\n    }\n    for i := range paths {\n        for j := i + 1; j < len(paths); j++ {\n            if strings.HasPrefix(paths[i], paths[j]) || strings.HasPrefix(paths[j], paths[i]) {\n                return true\n            }\n        }\n    }\n    return false\n}","typeGuard":null,"tryCatchPattern":"In Go: if err := checkOverlappingMountsLike(conf.Mounts); err != nil { reject config early with both offending paths } — the start-time error already names the pair; surface it verbatim.","preventionTips":["Design mounts as a flat set of disjoint subtrees — never nest one mount under another","Remember '~' (the default) overlaps every home-relative path: pass explicit mounts or none, not both","Clean paths before comparing so '~' vs absolute duplicates don't slip through your own checks"],"tags":["mounts","filesystem","config","validation"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}