hashicorp/nomad · error
http_max_size not a valid size: %w
Error message
http_max_size not a valid size: %w
What it means
This error is returned by ArtifactConfig.Validate in nomad/structs/config/artifact.go when the http_max_size string cannot be parsed as a byte size (e.g. "10gb", "500MB") by the humanize.ParseBytes parser. Nomad validates client artifact block configuration at load time so malformed agent configs fail fast. The wrapped parse error (%w) tells you exactly which part of the string the parser rejected.
Source
Thrown at nomad/structs/config/artifact.go:179
func (a *ArtifactConfig) Validate() error {
if a == nil {
return fmt.Errorf("artifact must not be nil")
}
if a.HTTPReadTimeout == nil {
return fmt.Errorf("http_read_timeout must be set")
}
if v, err := time.ParseDuration(*a.HTTPReadTimeout); err != nil {
return fmt.Errorf("http_read_timeout not a valid duration: %w", err)
} else if v < 0 {
return fmt.Errorf("http_read_timeout must be > 0")
}
if a.HTTPMaxSize == nil {
return fmt.Errorf("http_max_size must be set")
}
if v, err := humanize.ParseBytes(*a.HTTPMaxSize); err != nil {
return fmt.Errorf("http_max_size not a valid size: %w", err)
} else if v > math.MaxInt64 {
return fmt.Errorf("http_max_size must be < %d but found %d", int64(math.MaxInt64), v)
}
if a.GCSTimeout == nil {
return fmt.Errorf("gcs_timeout must be set")
}
if v, err := time.ParseDuration(*a.GCSTimeout); err != nil {
return fmt.Errorf("gcs_timeout not a valid duration: %w", err)
} else if v < 0 {
return fmt.Errorf("gcs_timeout must be > 0")
}
if a.GitTimeout == nil {
return fmt.Errorf("git_timeout must be set")
}
if v, err := time.ParseDuration(*a.GitTimeout); err != nil {
return fmt.Errorf("git_timeout not a valid duration: %w", err)View on GitHub (pinned to 482b49bf1a)
Solutions
- Fix the http_max_size string to a value humanize.ParseBytes accepts, e.g. "1gb", "500MB", "1024kb" (decimal SI units, no commas or spaces).
- Use a bare byte count like "1073741824" if no unit is desired.
- Check the wrapped %w error text to identify the exact offending character(s).
- Re-run nomad agent -config validation (or `nomad validate`) before restarting the agent.
Example fix
// before
artifact {
http_max_size = "1,000MB"
}
// after
artifact {
http_max_size = "1000MB"
} Defensive patterns
Strategy: validation
Validate before calling
// Go: check before building/submitting config
func validHTTPMaxSize(s *string) bool {
if s == nil { return false }
_, err := github.com/dustin/go-humanize.ParseBytes(*s) // humanize.ParseBytes
return err == nil
}
// Acceptable: "1gb", "500MB", "1073741824". Reject commas, spaces, unknown units. Type guard
func isByteSize(s string) bool {
_, err := humanize.ParseBytes(s)
return err == nil
} Prevention
- Always include a unit suffix from the set humanize supports (B, KB, MB, GB, TB...).
- Never use commas or spaces inside size literals.
- Run `nomad validate` on config files in CI before deploying.
- Keep artifact block values quoted as strings in HCL.
When it happens
Trigger: Setting `http_max_size` in an artifact config block to a string that humanize.ParseBytes cannot parse: non-numeric text ("ten gb"), unsupported units ("10kibibytes" misspelled, "10b/s"), a bare number with a trailing character ("10GB " with space or "10,Gb"), or an empty string.
Common situations: Copy-pasting config from docs with smart quotes or stray whitespace; assuming a bare integer or a unit humanize does not recognize works; typos like "10GBs" or "1,000MB"; templating tools injecting an empty or malformed value; upgrading Nomad after http_max_size was introduced and mixing old config fragments.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- wait config is nil or empty
- missing datacenter for client registration
- default_identity_ttl must be greater than 0
- max_identity_ttl must be greater than 0
- max_identity_ttl must be greater than or equal to default_id
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/aec3c5d3442e0bc6.
Report an issue: GitHub.