{"record":{"id":"265f2f4b1e9068a2","repo":"lima-vm/lima","slug":"path-q-contains-whitespace","errorCode":null,"errorMessage":"path %#q contains whitespace","messagePattern":"path %#q contains whitespace","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/networks/validate.go","lineNumber":105,"sourceCode":"// 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)\n\tif !ok {\n\t\t// should never happen\n\t\treturn fmt.Errorf(\"could not retrieve stat buffer for %#q\", path)","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/networks/validate.go#L87-L123","documentation":"validatePath rejects any configured path containing a space character, because these paths are interpolated into sudoers files and shell-ish daemon invocations where spaces break parsing. The error quotes the offending path.","triggerScenarios":"A `paths.*` value (or socket path) in networks.yaml contains a space — e.g. an install directory like '/Applications/My Tools/bin/socket_vmnet' — and networks.Validate runs validatePath on it.","commonSituations":"Installing vde/socket_vmnet under a directory with spaces ('Application Support', user names with spaces); copying a path from Finder with a volume name containing spaces.","solutions":["Move/reinstall the binary to a space-free absolute path (e.g. /usr/local/bin or /opt/homebrew/opt/...) and update networks.yaml.","If the directory name can't change, create a symlink from a space-free path and configure that path in networks.yaml.","Double-check the YAML value for accidental internal spaces or tabs.","Re-run validation after the change."],"exampleFix":"# before (networks.yaml)\npaths:\n  socketVMNet: \"/Applications/My Tools/bin/socket_vmnet\"\n# after\npaths:\n  socketVMNet: /usr/local/bin/socket_vmnet","handlingStrategy":"validation","validationCode":"function validateNoSpaces(p, field) {\n  if (!p) return null;\n  if (p.includes(' ')) return `${field}: '${p}' contains whitespace`;\n  return null;\n}\nObject.entries(config.paths || {}).forEach(([k, v]) => validateNoSpaces(v, `paths.${k}`));","typeGuard":"function isSpaceFreePath(p) {\n  return typeof p === 'string' && !p.includes(' ');\n}","tryCatchPattern":null,"preventionTips":["Install binaries into space-free directories (/usr/local, /opt/homebrew).","Symlink spaced directories to a space-free alias and reference the symlink.","Quote-check YAML strings after editing.","Avoid usernames/dirs with spaces for lima tooling installs."],"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"}