slimtoolkit/slim · error
error parsing field - %s (%v)
Error message
error parsing field - %s (%v)
What it means
A generic numeric-field parser (used for /etc/group-style records, e.g. GID or other integer fields) reports 'error parsing field' when strconv.Atoi fails on a non-empty field value. Empty fields are allowed (set to FieldNotSet), so this error only fires on non-numeric content.
Source
Thrown at pkg/sysidentity/sysidentity.go:537
intFields := [...]*int{
&record.LastChangeRaw,
&record.MinimumAge,
&record.MaximumAge,
&record.WarningPeriod,
&record.InactiveDays,
&record.ExpirationRaw,
}
for idx, val := range intFields {
field := parts[idx+2]
if field == "" {
*val = FieldNotSet
} else {
var err error
*val, err = strconv.Atoi(field)
if err != nil {
return record, fmt.Errorf("error parsing field - %s (%v)", field, err)
}
}
}
record.Password = NewPasswordHash(record.PasswordRaw)
var err error
record.LastChangeDate, err = daysToDate(record.LastChangeRaw)
if err != nil {
return record, err
}
record.ExpirationDate, err = daysToDate(record.ExpirationRaw)
if err != nil {
return record, err
}
return record, nil
}View on GitHub (pinned to 81940d17fa)
Solutions
- Locate the malformed record and correct the numeric field
- Check for CRLF or whitespace: cat -A /etc/group | grep the offending entry
- Run: awk -F: '$3 != "" && $3 !~ /^[0-9]+$/{print}' /etc/group
- Restore the identity file from a known-good copy
Example fix
// before devs:x:developers:user1 // after devs:x:1001:user1
Defensive patterns
Strategy: validation
Validate before calling
func validIdentityNumericFields(line string) bool {
for _, f := range strings.Split(line, ":") {
if f == "" { continue } // empty allowed -> FieldNotSet
if _, err := strconv.Atoi(strings.TrimSpace(f)); err != nil { return false }
}
return true
} Try / catch
rec, err := parseIdentityRecord(line)
if err != nil && strings.Contains(err.Error(), "error parsing field") {
log.Warnf("malformed numeric field, skipping: %v", err)
continue
} Prevention
- Ensure generated files use LF endings and no stray whitespace
- Quote/escape generated entries in provisioning scripts
- Validate identity files in CI before deployment
- Trim fields before writing them
When it happens
Trigger: Parsing a group/identity record where an integer field (e.g. GID) contains characters other than digits, such as a name or stray whitespace.
Common situations: Malformed /etc/group entries; automated tooling that wrote a group name where a GID belongs; locale/CRLF contamination introducing invisible bytes.
Related errors
- error parsing UID field - %s (%v)
- error parsing GID field - %s (%v)
- malformed Kubernetes workload name
- cannot detect host port
- when using JSON array syntax, arrays must be comprised of st
AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31).
Data as JSON: /api/errors/fe680a7aaf7e75c6.
Report an issue: GitHub.