{"record":{"id":"380584c34690c201","repo":"hashicorp/nomad","slug":"error-parsing-httpmaxsize-w","errorCode":null,"errorMessage":"error parsing HTTPMaxSize: %w","messagePattern":"error parsing HTTPMaxSize: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/config/artifact.go","lineNumber":45,"sourceCode":"\tDecompressionLimitSize      int64\n\n\tDisableArtifactInspection     bool\n\tDisableFilesystemIsolation    bool\n\tFilesystemIsolationExtraPaths []string\n\tSetEnvironmentVariables       string\n}\n\n// ArtifactConfigFromAgent creates a new internal readonly copy of the client\n// agent's ArtifactConfig. The config should have already been validated.\nfunc ArtifactConfigFromAgent(c *config.ArtifactConfig) (*ArtifactConfig, error) {\n\thttpReadTimeout, err := time.ParseDuration(*c.HTTPReadTimeout)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing HTTPReadTimeout: %w\", err)\n\t}\n\n\thttpMaxSize, err := humanize.ParseBytes(*c.HTTPMaxSize)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing HTTPMaxSize: %w\", err)\n\t}\n\n\tgcsTimeout, err := time.ParseDuration(*c.GCSTimeout)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing GCSTimeout: %w\", err)\n\t}\n\n\tgitTimeout, err := time.ParseDuration(*c.GitTimeout)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing GitTimeout: %w\", err)\n\t}\n\n\thgTimeout, err := time.ParseDuration(*c.HgTimeout)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing HgTimeout: %w\", err)\n\t}\n\n\ts3Timeout, err := time.ParseDuration(*c.S3Timeout)","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/config/artifact.go#L27-L63","documentation":"ArtifactConfigFromAgent converts the agent's ArtifactConfig into the internal readonly ArtifactConfig. HTTPMaxSize is a human-readable byte size string (e.g. \"100MB\") parsed with humanize.ParseBytes; if the string is not a valid size expression, the parse error is wrapped with this message and construction aborts, returning nil config.","triggerScenarios":"Calling ArtifactConfigFromAgent with an ArtifactConfig whose HTTPMaxSize pointer is set to a string humanize.ParseBytes cannot parse, such as \"100 MB\" (space), \"100mB\", \"10GiB\" without support, an empty string, or a bare number with a unit typo like \"100mbz\".","commonSituations":"Typo or unsupported unit in the client { artifact { http_max_size = ... } } HCL block of a Nomad agent config; config templating injecting an empty or malformed value; manually constructed configs in tests or API callers passing raw strings without validation.","solutions":["Fix the HTTPMaxSize value in the agent config to a valid humanize byte string, e.g. \"100MB\", \"1GB\", \"512MiB\" (no space between number and unit)","Pre-validate the value with humanize.ParseBytes before building the config to get a clearer failure point","If the value comes from environment or templating, check the rendered agent config for empty/whitespace values","Upgrade/verify the go-humanize version if using a unit you believe should be supported"],"exampleFix":"// before\nclient {\n  artifact {\n    http_max_size = \"100 MB\"\n  }\n}\n// after\nclient {\n  artifact {\n    http_max_size = \"100MB\"\n  }\n}","handlingStrategy":"validation","validationCode":"if _, err := humanize.ParseBytes(*c.HTTPMaxSize); err != nil {\n    return fmt.Errorf(\"invalid http_max_size %q: %w\", *c.HTTPMaxSize, err)\n}","typeGuard":"func validByteSize(s *string) bool { if s == nil { return false }; _, err := humanize.ParseBytes(*s); return err == nil }","tryCatchPattern":"cfg, err := config.ArtifactConfigFromAgent(agentCfg)\nif err != nil {\n    if strings.Contains(err.Error(), \"error parsing HTTPMaxSize\") {\n        return fmt.Errorf(\"fix http_max_size in agent config: %w\", err)\n    }\n    return err\n}","preventionTips":["Always write size values with no space between number and unit: \"100MB\", \"1GiB\"","Validate the raw agent config with humanize.ParseBytes before startup","Use config linting/templating checks to catch empty interpolated values"],"tags":["config","parsing","duration","go"],"backgroundTag":"invalid-duration-or-size-config","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"}