{"record":{"id":"aec3c5d3442e0bc6","repo":"hashicorp/nomad","slug":"http-max-size-not-a-valid-size-w","errorCode":null,"errorMessage":"http_max_size not a valid size: %w","messagePattern":"http_max_size not a valid size: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/config/artifact.go","lineNumber":179,"sourceCode":"func (a *ArtifactConfig) Validate() error {\n\tif a == nil {\n\t\treturn fmt.Errorf(\"artifact must not be nil\")\n\t}\n\n\tif a.HTTPReadTimeout == nil {\n\t\treturn fmt.Errorf(\"http_read_timeout must be set\")\n\t}\n\tif v, err := time.ParseDuration(*a.HTTPReadTimeout); err != nil {\n\t\treturn fmt.Errorf(\"http_read_timeout not a valid duration: %w\", err)\n\t} else if v < 0 {\n\t\treturn fmt.Errorf(\"http_read_timeout must be > 0\")\n\t}\n\n\tif a.HTTPMaxSize == nil {\n\t\treturn fmt.Errorf(\"http_max_size must be set\")\n\t}\n\tif v, err := humanize.ParseBytes(*a.HTTPMaxSize); err != nil {\n\t\treturn fmt.Errorf(\"http_max_size not a valid size: %w\", err)\n\t} else if v > math.MaxInt64 {\n\t\treturn fmt.Errorf(\"http_max_size must be < %d but found %d\", int64(math.MaxInt64), v)\n\t}\n\n\tif a.GCSTimeout == nil {\n\t\treturn fmt.Errorf(\"gcs_timeout must be set\")\n\t}\n\tif v, err := time.ParseDuration(*a.GCSTimeout); err != nil {\n\t\treturn fmt.Errorf(\"gcs_timeout not a valid duration: %w\", err)\n\t} else if v < 0 {\n\t\treturn fmt.Errorf(\"gcs_timeout must be > 0\")\n\t}\n\n\tif a.GitTimeout == nil {\n\t\treturn fmt.Errorf(\"git_timeout must be set\")\n\t}\n\tif v, err := time.ParseDuration(*a.GitTimeout); err != nil {\n\t\treturn fmt.Errorf(\"git_timeout not a valid duration: %w\", err)","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/config/artifact.go#L161-L197","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nartifact {\n  http_max_size = \"1,000MB\"\n}\n// after\nartifact {\n  http_max_size = \"1000MB\"\n}","handlingStrategy":"validation","validationCode":"// Go: check before building/submitting config\nfunc validHTTPMaxSize(s *string) bool {\n    if s == nil { return false }\n    _, err := github.com/dustin/go-humanize.ParseBytes(*s) // humanize.ParseBytes\n    return err == nil\n}\n// Acceptable: \"1gb\", \"500MB\", \"1073741824\". Reject commas, spaces, unknown units.","typeGuard":"func isByteSize(s string) bool {\n    _, err := humanize.ParseBytes(s)\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["config","validation","nomad","artifact"],"backgroundTag":"invalid-config-value","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}