{"record":{"id":"c2af28ea5c543ae1","repo":"gastownhall/beads","slug":"s-q-is-not-an-absolute-native-path","errorCode":null,"errorMessage":"%s %q is not an absolute native path","messagePattern":"(.+?) %q is not an absolute native path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/user_config_path.go","lineNumber":55,"sourceCode":"\t\tcandidates.documented = filepath.Clean(filepath.Join(home, \".config\", \"bd\", \"config.yaml\"))\n\t}\n\n\tif nativeDir, err := cleanAbsoluteUserDirectory(\"native user config directory\", nativeConfigDir, nativeErr); err != nil {\n\t\tcandidates.nativeErr = err\n\t} else {\n\t\tcandidates.native = filepath.Clean(filepath.Join(nativeDir, \"bd\", \"config.yaml\"))\n\t}\n\n\treturn candidates\n}\n\nfunc cleanAbsoluteUserDirectory(label, path string, resolutionErr error) (string, error) {\n\tif resolutionErr != nil {\n\t\treturn \"\", fmt.Errorf(\"%s: %w\", label, resolutionErr)\n\t}\n\tcleaned := filepath.Clean(path)\n\tif !filepath.IsAbs(cleaned) {\n\t\treturn \"\", fmt.Errorf(\"%s %q is not an absolute native path\", label, path)\n\t}\n\treturn cleaned, nil\n}\n\n// UserConfigYamlPath resolves the user-level config.yaml to a cleaned,\n// absolute path suitable for native filesystem APIs. It prefers the documented\n// <home>/.config/bd location when that file exists, then an existing native\n// os.UserConfigDir location. For a new file it keeps the documented location\n// as the creation target when possible, falling back to the native location\n// only when the home directory itself cannot be resolved safely.\nfunc UserConfigYamlPath() (string, error) {\n\treturn selectUserConfigYamlPath(currentUserConfigYamlCandidates())\n}\n\nfunc selectUserConfigYamlPath(candidates userConfigYamlCandidates) (string, error) {\n\tif userConfigPathExists(candidates.documented) {\n\t\treturn candidates.documented, nil\n\t}","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/config/user_config_path.go#L37-L73","documentation":"cleanAbsoluteUserDirectory validates that a resolved user-directory candidate is an absolute, native (non-MSYS/POSIX-style) path before it can be used for filesystem APIs. It throws when filepath.Clean produces a relative path, meaning the underlying resolution (e.g. HOME or USERPROFILE) yielded something non-absolute. This guards user config.yaml resolution from silently using mangled directory roots.","triggerScenarios":"Calling UserConfigYamlPath / buildUserConfigYamlCandidates when the resolved home directory variable (HOME, USERPROFILE) is set to a relative path like 'foo' or an MSYS-style root like '/c/Users' on Windows, so filepath.IsAbs fails after Clean.","commonSituations":"Developers on Windows running bd inside Git Bash/MSYS where HOME=/c/Users/name leaks into the Go process; CI containers with HOME set to a relative path; shell profiles exporting a tilde or relative HOME.","solutions":["Fix the environment variable: set HOME (or USERPROFILE on Windows) to a fully qualified native absolute path (e.g. C:\\Users\\name, not /c/Users/name).","Unset the MSYS/MSYS2 path translation (e.g. run from cmd/PowerShell instead of Git Bash, or unset MSYS overrides).","If a custom home override is intended, pass an absolute path when invoking bd.","Upgrade bd: newer versions reject MSYS roots with a clearer label naming which candidate failed."],"exampleFix":"// before (Git Bash on Windows)\nexport HOME=/c/Users/alice\nbd ready\n// after\nexport HOME='C:\\Users\\alice'\nbd ready","handlingStrategy":"validation","validationCode":"home := os.Getenv(\"HOME\") // or USERPROFILE on Windows\nif home == \"\" || !filepath.IsAbs(filepath.Clean(home)) {\n    return fmt.Errorf(\"HOME must be an absolute native path, got %q\", home)\n}","typeGuard":"func isAbsoluteNativePath(p string) bool {\n    return p != \"\" && filepath.IsAbs(filepath.Clean(p))\n}","tryCatchPattern":null,"preventionTips":["Never export HOME as an MSYS-style path (/c/...) in shells that launch native Go binaries.","Validate HOME/USERPROFILE is absolute in shell profiles and CI setup scripts.","Run bd from a native shell (cmd/PowerShell on Windows) or unset MSYS path overrides.","Add a preflight env check in wrapper scripts before invoking bd."],"tags":["config","path-validation","windows","environment"],"backgroundTag":"non-absolute-path","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}