tailscale/tailscale · error
locale error: %w
Error message
locale error: %w
What it means
Fired in locale() when running the external `locale` command fails with an error other than exec.ErrNotFound (the binary exists but exited non-zero, or exec failed for another reason); LANG/LC_CTYPE detection fails, so callers cannot determine UTF-8 support.
Source
Thrown at util/qrcodes/qrcodes_linux.go:98
format = FormatSmall
}
return format, nil
}
func locale() (map[string]string, error) {
locale := map[string]string{
"LANG": os.Getenv("LANG"),
"LC_CTYPE": os.Getenv("LC_CTYPE"),
}
cmd := exec.Command("locale")
out, err := cmd.Output()
if err != nil {
if errors.Is(err, exec.ErrNotFound) {
return locale, nil
}
return nil, fmt.Errorf("locale error: %w", err)
}
for line := range strings.SplitSeq(string(out), "\n") {
if line == "" {
continue
}
k, v, found := strings.Cut(line, "=")
if !found {
continue
}
v, err := strconv.Unquote(v)
if err != nil {
continue
}
locale[k] = v
}
return locale, nil
}View on GitHub (pinned to 6e0912f979)
Solutions
- Rely on the pre-populated env-var values (LANG/LC_CTYPE) as fallback
- Check why `locale` exits non-zero in the environment
- Treat locale detection as best-effort and skip errors
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at util/qrcodes/qrcodes_linux.go:98 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tailscale/tailscale@6e0912f979 (2026-08-18).
Data as JSON: /api/errors/a23db484e1ca4395.
Report an issue: GitHub.