{"record":{"id":"52ac552125e2743f","repo":"lima-vm/lima","slug":"path-q-is-not-an-absolute-path","errorCode":null,"errorMessage":"path %#q is not an absolute path","messagePattern":"path %#q is not an absolute path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/networks/validate.go","lineNumber":102,"sourceCode":"\treturn nil\n}\n\n// findBaseDirectory removes non-existing directories from the end of the path.\nfunc findBaseDirectory(path string) string {\n\tif _, err := os.Lstat(path); errors.Is(err, os.ErrNotExist) {\n\t\tif path != \"/\" {\n\t\t\treturn findBaseDirectory(filepath.Dir(path))\n\t\t}\n\t}\n\treturn path\n}\n\nfunc validatePath(path string, allowDaemonGroupWritable bool) error {\n\tif path == \"\" {\n\t\treturn nil\n\t}\n\tif path[0] != '/' {\n\t\treturn fmt.Errorf(\"path %#q is not an absolute path\", path)\n\t}\n\tif strings.ContainsRune(path, ' ') {\n\t\treturn fmt.Errorf(\"path %#q contains whitespace\", path)\n\t}\n\tfi, err := os.Lstat(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfile := \"file\"\n\tif fi.Mode().IsDir() {\n\t\tfile = \"dir\"\n\t}\n\t// TODO: should we allow symlinks when both the link and the target are secure?\n\t// E.g. on macOS /var is a symlink to /private/var, /etc to /private/etc\n\tif (fi.Mode() & fs.ModeSymlink) != 0 {\n\t\treturn fmt.Errorf(\"%s %#q is a symlink\", file, path)\n\t}\n\tstat, ok := osutil.SysStat(fi)","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/networks/validate.go#L84-L120","documentation":"validatePath enforces that every path used in networks.yaml (binaries, sockets) is an absolute path starting with '/', because these values are embedded into sudoers rules and daemon arguments. A relative path fails immediately with this error.","triggerScenarios":"A `paths.*` entry or socket path in networks.yaml is given as a relative value (e.g. 'bin/socket_vmnet' or '~/opt/socket_vmnet'); validatePath is invoked from Validate for each configured path.","commonSituations":"Using '~' in the path (not expanded to an absolute path); editing networks.yaml with a relative path assuming CWD resolution; templating the config with variables that resolved empty.","solutions":["Replace the value with a fully absolute path starting with '/' (expand ~ manually, e.g. /Users/alice/opt/socket_vmnet/bin/socket_vmnet).","Also avoid whitespace in the path (next check after this one).","Re-run validation after fixing.","If the binary lives under your home dir, symlink or install it into a standard absolute location like /usr/local/bin or the Homebrew prefix."],"exampleFix":"# before (networks.yaml)\npaths:\n  vdeSwitch: ~/opt/vde/bin/vde_switch\n# after\npaths:\n  vdeSwitch: /Users/alice/opt/vde/bin/vde_switch","handlingStrategy":"validation","validationCode":"function validateAbsolutePath(p, field) {\n  if (!p) return null;\n  if (!p.startsWith('/')) return `${field}: '${p}' is not an absolute path`;\n  return null;\n}\nObject.entries(config.paths || {}).forEach(([k, v]) => validateAbsolutePath(v, `paths.${k}`));","typeGuard":"function isAbsolutePath(p) {\n  return typeof p === 'string' && p.startsWith('/');\n}","tryCatchPattern":null,"preventionTips":["Always expand ~ to a full home path before writing it into networks.yaml.","Never use relative paths in lima config files.","Generate paths programmatically from absolute prefixes (brew --prefix).","Review generated YAML for empty-variable placeholders."],"tags":["config","validation","paths","networks-yaml"],"backgroundTag":"invalid-config-path","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}