{"record":{"id":"4f5a1cf8329120b0","repo":"abiosoft/colima","slug":"relative-paths-not-supported-for-mount-s","errorCode":null,"errorMessage":"relative paths not supported for mount '%s'","messagePattern":"relative paths not supported for mount '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/util.go","lineNumber":169,"sourceCode":"\treturn split\n}\n\n// CleanPath returns the absolute path to the mount location.\n// If location is an empty string, nothing is done.\nfunc CleanPath(location string) (string, error) {\n\tif location == \"\" {\n\t\treturn \"\", nil\n\t}\n\n\tstr := os.ExpandEnv(location)\n\n\tif strings.HasPrefix(str, \"~\") {\n\t\tstr = strings.Replace(str, \"~\", HomeDir(), 1)\n\t}\n\n\tstr = filepath.Clean(str)\n\tif !filepath.IsAbs(str) {\n\t\treturn \"\", fmt.Errorf(\"relative paths not supported for mount '%s'\", location)\n\t}\n\n\treturn strings.TrimSuffix(str, \"/\") + \"/\", nil\n}\n","sourceCodeStart":151,"sourceCodeEnd":174,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/util/util.go#L151-L174","documentation":"CleanPath (util/util.go:154-171) normalizes a mount location for Lima mounts: it skips empty strings, expands environment variables (os.ExpandEnv), expands a leading ~ to the home dir, cleans the path, then rejects anything that is not absolute with 'relative paths not supported for mount'. Lima bind mounts operate on host paths the VM must resolve, so colima requires an unambiguous absolute location before VM start.","triggerScenarios":"`colima start --mount type=9p,location=./src,target=/src` (cwd-relative), `--mount location=www:target=/www`, or mounts in the colima YAML/CLI flags where an expanded $VAR ends up relative because the variable is unset (expands to empty).","commonSituations":"Docker users assuming `docker run -v src:/dst`-style relative bind paths; unset environment variables inside mount strings; tilde placed mid-path where it isn't expanded; config files written on one machine with absolute paths valid only there.","solutions":["Use an absolute path or a leading ~: `--mount location=~/src,target=/src`","Ensure every $VAR referenced in a mount location is actually set in colima's environment (unset vars expand to empty, making the path relative)","For repo-local dirs, pass $(pwd): `--mount location=$(pwd)/src,target=/src`","Keep mounts in ~/.colima/_lima/<profile> overrides consistent and absolute"],"exampleFix":"# before\ncolima start --mount type=9p,location=./www,target=/www\n# Error: relative paths not supported for mount './www'\n\n# after\ncolima start --mount type=9p,location=~/projects/www,target=/www","handlingStrategy":"validation","validationCode":"// validate a mount location exactly like CleanPath does, before start\nfunc validMountLocation(loc string) error {\n    s := filepath.Clean(os.ExpandEnv(loc))\n    if strings.HasPrefix(s, \"~\") { s = filepath.Clean(HomeDir() + s[1:]) }\n    if !filepath.IsAbs(s) { return fmt.Errorf(\"mount %q must be absolute\", loc) }\n    return nil\n}","typeGuard":"func isRelativeMountError(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"relative paths not supported for mount\")\n}","tryCatchPattern":"if p, err := util.CleanPath(location); err != nil {\n    if isRelativeMountError(err) {\n        // user-fixable: tell them to prefix with ~ or $(pwd), then exit\n        return fmt.Errorf(\"fix mount path and retry: %w\", err)\n    }\n    return err\n}","preventionTips":["Always write mounts as absolute paths or with a leading ~","Verify every $VAR in mount strings is set in colima's environment","Use $(pwd) in shell one-liners for repo-relative mounts","Lint your colima YAML/flags for absolute mount paths in setup scripts"],"tags":["mounts","paths","validation","filesystem"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}