gastownhall/beads · error
resolve user config.yaml: %w
Error message
resolve user config.yaml: %w
What it means
selectUserConfigYamlPath aggregates all candidate-resolution failures (home dir error, native dir error) with errors.Join and wraps them under 'resolve user config.yaml'. It also throws when every candidate resolved but none was an absolute native directory ('no absolute native user directory is available'). It is the top-level wrapper for user-level config.yaml path resolution.
Source
Thrown at internal/config/user_config_path.go:88
func selectUserConfigYamlPath(candidates userConfigYamlCandidates) (string, error) {
if userConfigPathExists(candidates.documented) {
return candidates.documented, nil
}
if candidates.native != candidates.documented && userConfigPathExists(candidates.native) {
return candidates.native, nil
}
if candidates.documented != "" {
return candidates.documented, nil
}
if candidates.native != "" {
return candidates.native, nil
}
err := errors.Join(candidates.homeErr, candidates.nativeErr)
if err == nil {
err = errors.New("no absolute native user directory is available")
}
return "", fmt.Errorf("resolve user config.yaml: %w", err)
}
// UserConfigYamlDisplayPath returns a human-readable location for command
// output. The tilde form is deliberately confined to this display-only API and
// must never be passed to a filesystem operation.
func UserConfigYamlDisplayPath() string {
return userConfigYamlDisplayPath(currentUserConfigYamlCandidates())
}
func userConfigYamlDisplayPath(candidates userConfigYamlCandidates) string {
if path, err := selectUserConfigYamlPath(candidates); err == nil {
return path
}
return userConfigYamlDisplayFallback
}
func userConfigPathExists(path string) bool {
if path == "" {View on GitHub (pinned to 71377f2769)
Solutions
- Set HOME to a valid absolute native path (POSIX) or USERPROFILE (Windows), then retry.
- Run outside MSYS/Git Bash or unset MSYS-injected HOME overrides.
- Ensure the user account has a defined home directory (check `echo $HOME` / `echo %USERPROFILE%`).
- Inspect the joined sub-errors in the message to see which candidate (home vs native) failed and fix that root.
Example fix
// before (Dockerfile) USER app CMD ["bd", "ready"] // after ENV HOME=/home/app USER app CMD ["bd", "ready"]
Defensive patterns
Strategy: validation
Validate before calling
for _, v := range []string{"HOME", "USERPROFILE"} {
if p := os.Getenv(v); p != "" && !filepath.IsAbs(p) {
return fmt.Errorf("%s=%q is not absolute", v, p)
}
} Type guard
func hasUsableHomeDir() bool {
for _, v := range []string{"HOME", "USERPROFILE"} {
if p := os.Getenv(v); p != "" && filepath.IsAbs(p) {
return true
}
}
return false
} Try / catch
path, err := config.UserConfigYamlPath()
if err != nil {
// err wraps joined candidate sub-errors; surface them for diagnosis
return fmt.Errorf("fix HOME/USERPROFILE: %w", err)
} Prevention
- Always define HOME (POSIX) or USERPROFILE (Windows) in containers and CI images.
- Set ENV HOME=/home/app in Dockerfiles before switching to a non-root USER.
- Avoid launching bd from MSYS/Git Bash with inherited translated paths.
- Sanity-check `echo $HOME` before debugging config commands.
When it happens
Trigger: Calling UserConfigYamlPath, userConfigYamlDisplayPath, or any API that resolves the user config when both the home-directory candidate and the native-directory candidate fail — e.g. HOME relative/MSYS-style and USERPROFILE missing or invalid.
Common situations: Windows environments under Git Bash/MSYS with mangled HOME; containers running as a user with no HOME set; stripped CI images lacking USERPROFILE.
Related errors
- newProxiedServerUOWProvider: resolve root path: %w
- repository not found: %s
- %s: %w
- %s %q is not an absolute native path
- server: NewDoltServer: doltBinExec is required
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/723f555598f00eaf.
Report an issue: GitHub.