{"record":{"id":"933db1de188a0d4e","repo":"hashicorp/nomad","slug":"decompression-size-limit-must-be-d-but-found-d","errorCode":null,"errorMessage":"decompression_size_limit must be < %d but found %d","messagePattern":"decompression_size_limit must be < (.+?) but found (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/config/artifact.go","lineNumber":233,"sourceCode":"\t\treturn fmt.Errorf(\"s3_timeout not a valid duration: %w\", err)\n\t} else if v < 0 {\n\t\treturn fmt.Errorf(\"s3_timeout must be > 0\")\n\t}\n\n\tif a.DecompressionFileCountLimit == nil {\n\t\treturn fmt.Errorf(\"decompression_file_count_limit must not be nil\")\n\t}\n\tif v := *a.DecompressionFileCountLimit; v < 0 {\n\t\treturn fmt.Errorf(\"decompression_file_count_limit must be >= 0 but found %d\", v)\n\t}\n\n\tif a.DecompressionSizeLimit == nil {\n\t\treturn fmt.Errorf(\"decompression_size_limit must not be nil\")\n\t}\n\tif v, err := humanize.ParseBytes(*a.DecompressionSizeLimit); err != nil {\n\t\treturn fmt.Errorf(\"decompression_size_limit is not a valid size: %w\", err)\n\t} else if v > math.MaxInt64 {\n\t\treturn fmt.Errorf(\"decompression_size_limit must be < %d but found %d\", int64(math.MaxInt64), v)\n\t}\n\n\tif a.DisableArtifactInspection == nil {\n\t\treturn fmt.Errorf(\"disable_artifact_inspection must be set\")\n\t}\n\n\tif a.DisableFilesystemIsolation == nil {\n\t\treturn fmt.Errorf(\"disable_filesystem_isolation must be set\")\n\t}\n\n\tfor _, p := range a.FilesystemIsolationExtraPaths {\n\t\tif _, err := landlock.ParsePath(p); err != nil {\n\t\t\treturn fmt.Errorf(\"filesystem_isolation_extra_paths contains invalid lockdown path %q\", p)\n\t\t}\n\t}\n\n\tif a.SetEnvironmentVariables == nil {\n\t\treturn fmt.Errorf(\"set_environment_variables must be set\")","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/config/artifact.go#L215-L251","documentation":"Validate() rejects decompression_size_limit values exceeding math.MaxInt64. humanize.ParseBytes returns uint64, but Nomad stores/compares the cap as int64 internally, so sizes above ~9.22 EB fail with 'must be < %d but found %d'.","triggerScenarios":"Calling ArtifactConfig.Validate() when humanize.ParseBytes(*a.DecompressionSizeLimit) succeeds but returns v > math.MaxInt64, e.g. \"10EB\" or \"9223372036854775808B\".","commonSituations":"Setting an astronomically large limit to 'disable' the cap (e.g. 1ZB); template interpolation of huge numbers; misunderstanding that uint64 inputs must fit int64 for internal math.","solutions":["Set a realistic cap below MaxInt64, e.g. decompression_size_limit = \"10GB\".","To effectively disable the cap, use the largest practical value such as \"8EB\" (below MaxInt64) rather than exceeding it.","Clamp in code: if v > math.MaxInt64 { v = math.MaxInt64 } before assigning the string form."],"exampleFix":"// before\nartifact {\n  decompression_size_limit = \"10ZB\"\n}\n// after\nartifact {\n  decompression_size_limit = \"8EB\"\n}","handlingStrategy":"validation","validationCode":"v, err := humanize.ParseBytes(cfg.DecompressionSizeLimit)\nif err == nil && v > math.MaxInt64 {\n    return fmt.Errorf(\"decompression_size_limit %q exceeds int64 max\", cfg.DecompressionSizeLimit)\n}","typeGuard":"func fitsInt64(s *string) bool {\n    if s == nil { return false }\n    v, err := humanize.ParseBytes(*s)\n    return err == nil && v <= math.MaxInt64\n}","tryCatchPattern":null,"preventionTips":["Cap size limits at values below 9223372036854775807 bytes (use \"8EB\" at most).","Don't use absurd sizes to disable caps; pick a sane ceiling.","Add an upper-bound assertion wherever size strings are generated programmatically."],"tags":["nomad","config-validation","overflow","decompression"],"backgroundTag":"config-value-out-of-range","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"}