hashicorp/nomad · error
unable to convert userid %s to integer
Error message
unable to convert userid %s to integer
What it means
getUserID converts the Unix user's Uid string (from user.User) to a UserID via strconv.ParseUint. This error means the uid string on the system could not be parsed as an unsigned 32-bit integer, so the validator cannot check whether the uid is denied. It is wrapped by HasValidIDs as 'validator: ...'.
Source
Thrown at drivers/shared/validators/validators_unix.go:17
// Copyright IBM Corp. 2015, 2026
// SPDX-License-Identifier: MPL-2.0
//go:build !windows
package validators
import (
"fmt"
"os/user"
"strconv"
)
func getUserID(user *user.User) (UserID, error) {
id, err := strconv.ParseUint(user.Uid, 10, 32)
if err != nil {
return 0, fmt.Errorf("unable to convert userid %s to integer", user.Uid)
}
return UserID(id), nil
}
func getGroupsID(user *user.User) ([]GroupID, error) {
gidStrings, err := user.GroupIds()
if err != nil {
return []GroupID{}, fmt.Errorf("unable to lookup user's group membership: %w", err)
}
gids := make([]GroupID, len(gidStrings))
for _, gidString := range gidStrings {
u, err := strconv.ParseUint(gidString, 10, 32)
if err != nil {
return []GroupID{}, fmt.Errorf("unable to convert user's group %q to integer: %w", gidString, err)
}View on GitHub (pinned to 482b49bf1a)
Solutions
- Inspect the user's entry in the NSS source (getent passwd <user>) and fix the malformed uid
- Repair /etc/passwd or the directory service entry for the affected user
- Check that /etc/nsswitch.conf points at the intended passwd sources
- If a directory service returns uids above 4294967295, remap the user to a uid within uint32 range
Example fix
// before (bad passwd entry) baduser:x:abc:1000::/home/baduser:/bin/bash // after baduser:x:15000:1000::/home/baduser:/bin/bash
Defensive patterns
Strategy: validation
Validate before calling
u, err := user.Lookup(username)
if err != nil { return err }
if _, err := strconv.ParseUint(u.Uid, 10, 32); err != nil {
return fmt.Errorf("uid %q for user %s is not a valid uint32", u.Uid, username)
} Type guard
func validUID(uid string) bool {
_, err := strconv.ParseUint(uid, 10, 32)
return err == nil
} Prevention
- Verify 'getent passwd <user>' returns a numeric uid before scheduling tasks as that user
- Monitor NSS/directory-service health on hosts running tasks
- Avoid hand-editing /etc/passwd; use useradd/usermod
- Keep uids within the standard uint32 range (<= 4294967294)
When it happens
Trigger: Calling Validator.HasValidIDs(userName) on a Unix system where users.Lookup succeeds but user.Uid is empty, non-numeric, or exceeds uint32 range (e.g. a malformed /etc/passwd entry or NSS source returning a bad uid string).
Common situations: Broken /etc/passwd or corrupted LDAP/SSSD/AD-backed NSS entries returning garbage uid fields; containers with unusual user databases; systems where uid values exceed 2^32-1.
Related errors
- error parsing uid: %w
- error parsing gid: %w
- failed to get current user: %w
- failed to identify user %v: %v
- unable to lookup user's group membership: %w
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/1011b96871cd2e4c.
Report an issue: GitHub.