AdguardTeam/AdGuardHome · error
parsing uid: %w
Error message
parsing uid: %w
What it means
After a successful user lookup, the Uid string failed strconv.Atoi — the user database returned a non-numeric uid. UIDs are numeric by definition, so this signals malformed system data rather than bad input.
Source
Thrown at internal/aghos/user_unix.go:39
}
err = syscall.Setgid(gid)
if err != nil {
return fmt.Errorf("setting gid: %w", err)
}
return nil
}
func setUser(userName string) (err error) {
u, err := user.Lookup(userName)
if err != nil {
return fmt.Errorf("looking up user: %w", err)
}
uid, err := strconv.Atoi(u.Uid)
if err != nil {
return fmt.Errorf("parsing uid: %w", err)
}
err = syscall.Setuid(uid)
if err != nil {
return fmt.Errorf("setting uid: %w", err)
}
return nil
}
View on GitHub (pinned to b41aefbe51)
Solutions
- Inspect the entry: getent passwd <name> — third field must be an integer
- Repair /etc/passwd or the LDAP uidNumber attribute
- Defensively, prefer strconv.ParseUint and validate the range before Setuid
Defensive patterns
Strategy: validation
Validate before calling
u, err := user.Lookup(name)
if err == nil {
if _, err := strconv.Atoi(u.Uid); err != nil { /* malformed passwd DB */ }
} Prevention
- Validate numeric uids after lookup
- Lint /etc/passwd after manual edits
- Verify LDAP uidNumber attributes are numeric
When it happens
Trigger: user.Lookup returns a User with a non-numeric Uid field — corrupted /etc/passwd, a broken NSS module, or an auth backend returning empty/malformed uid fields.
Common situations: Hand-edited /etc/passwd with errors; LDAP entries with invalid uidNumber attributes; essentially never occurs with a healthy user database.
Related errors
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/0b43d8e1bdc32403.
Report an issue: GitHub.