hashicorp/nomad · error

Failed to parse %s as bool: %s

Error message

Failed to parse %s as bool: %s

What it means

Config.ReadBool looks up a client option by id and parses it with strconv.ParseBool; this error fires when the option exists but its value is not a recognizable boolean (accepted: 1/t/T/true/0/f/F/false). Callers using ReadBoolDefault silently fall back instead.

Source

Thrown at client/config/config.go:1010

	for _, id := range ids {
		val, ok := c.Options[id]
		if ok {
			return val
		}
	}

	return defaultValue
}

// ReadBool parses the specified option as a boolean.
func (c *Config) ReadBool(id string) (bool, error) {
	val, ok := c.Options[id]
	if !ok {
		return false, fmt.Errorf("Specified config is missing from options")
	}
	bval, err := strconv.ParseBool(val)
	if err != nil {
		return false, fmt.Errorf("Failed to parse %s as bool: %s", val, err)
	}
	return bval, nil
}

// 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 {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set the client option to a valid boolean string (true/false/1/0)
  2. Use ReadBoolDefault where a fallback is acceptable
  3. Validate the option value at agent config load time
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at client/config/config.go:1010 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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