hashicorp/nomad · error

unable to convert user's group %q to integer: %w

Error message

unable to convert user's group %q to integer: %w

What it means

After GroupIds() returns gid strings, getGroupsID parses each one with strconv.ParseUint; this error indicates one of the returned group id strings could not be converted to an unsigned 32-bit integer. The whole group list is discarded and HasValidIDs fails with 'validator: ...'.

Source

Thrown at drivers/shared/validators/validators_unix.go:34

	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)
		}

		gids = append(gids, GroupID(u))
	}

	return gids, nil
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Run 'id <username>' to see the raw gid list and identify the malformed gid
  2. Fix the offending group entry in /etc/group or in the directory service (give it a numeric gid within uint32 range)
  3. Remove the user from the group with the malformed gid
  4. If a directory service hands out gids > 4294967295, remap those groups to valid gids

Example fix

// before (bad /etc/group entry)
brokengrp:x:1e4:user1
// after
brokengrp:x:15000:user1
Defensive patterns

Strategy: validation

Validate before calling

for _, g := range strings.Fields(userGidListOutput) {
	if _, err := strconv.ParseUint(g, 10, 32); err != nil {
		return fmt.Errorf("host group database has malformed gid %q", g)
	}
}

Type guard

func validGID(gid string) bool {
	_, err := strconv.ParseUint(gid, 10, 32)
	return err == nil
}

Prevention

When it happens

Trigger: Calling Validator.HasValidIDs(userName) when the OS/NSS returns a group membership list containing an empty, non-numeric, or >uint32 gid string for that user.

Common situations: Corrupt /etc/group entries or malformed gids from LDAP/SSSD; gid values exceeding 2^32-1 from a directory service; partially-written group database during system provisioning.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/ae841f7cc2c97a48. Report an issue: GitHub.