hashicorp/nomad · error
Failed to parse %s as int: %s
Error message
Failed to parse %s as int: %s
What it means
Config.ReadInt parses a client option with strconv.Atoi; this error fires when the option value is present but not an integer. Callers using ReadIntDefault swallow the error and use the default instead.
Source
Thrown at client/config/config.go:1033
// ReadBoolDefault tries to parse the specified option as a boolean. If there is
// an error in parsing, the default option is returned.
func (c *Config) ReadBoolDefault(id string, defaultValue bool) bool {
val, err := c.ReadBool(id)
if err != nil {
return defaultValue
}
return val
}
// ReadInt parses the specified option as a int.
func (c *Config) ReadInt(id string) (int, error) {
val, ok := c.Options[id]
if !ok {
return 0, fmt.Errorf("Specified config is missing from options")
}
ival, err := strconv.Atoi(val)
if err != nil {
return 0, fmt.Errorf("Failed to parse %s as int: %s", val, err)
}
return ival, nil
}
// ReadIntDefault tries to parse the specified option as a int. If there is
// an error in parsing, the default option is returned.
func (c *Config) ReadIntDefault(id string, defaultValue int) int {
val, err := c.ReadInt(id)
if err != nil {
return defaultValue
}
return val
}
// ReadDuration parses the specified option as a duration.
func (c *Config) ReadDuration(id string) (time.Duration, error) {
val, ok := c.Options[id]
if !ok {View on GitHub (pinned to 482b49bf1a)
Solutions
- Correct the option value to a plain integer
- Use ReadIntDefault to tolerate bad values
- Reject non-numeric values during config validation
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at client/config/config.go:1033 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/539ca8089d7a1996.
Report an issue: GitHub.