{"record":{"id":"271e3d43defe3e66","repo":"hashicorp/nomad","slug":"decompression-size-limit-must-not-be-nil","errorCode":null,"errorMessage":"decompression_size_limit must not be nil","messagePattern":"decompression_size_limit must not be nil","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/config/artifact.go","lineNumber":228,"sourceCode":"\n\tif a.S3Timeout == nil {\n\t\treturn fmt.Errorf(\"s3_timeout must be set\")\n\t}\n\tif v, err := time.ParseDuration(*a.S3Timeout); err != nil {\n\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)","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/config/artifact.go#L210-L246","documentation":"decompression_size_limit is a human-readable byte-size string (parsed by humanize.ParseBytes, e.g. \"1GB\"). Validate() fails with 'decompression_size_limit must not be nil' when the field was never set, because Nomad requires the decompression byte cap to be explicit to guard against decompression bombs.","triggerScenarios":"Calling ArtifactConfig.Validate() where a.DecompressionSizeLimit is a nil *string because the key is absent from the config source.","commonSituations":"Configs predating the size-limit feature; hand-built structs in Go code or tests; variables left empty in templates ({{var}} omitted) so the key vanishes; merge helpers that skip empty strings and nil alike.","solutions":["Add decompression_size_limit = \"1GB\" (or an appropriate size) to the artifact block.","Start from DefaultArtifactConfig(), which populates DecompressionSizeLimit, before overriding.","Ensure your templating/rendering pipeline never drops the key; fail at render time when the variable is empty."],"exampleFix":"// before\nartifact {\n  # decompression_size_limit missing\n}\n// after\nartifact {\n  decompression_size_limit = \"1GB\"\n}","handlingStrategy":"validation","validationCode":"if cfg.DecompressionSizeLimit == nil || *cfg.DecompressionSizeLimit == \"\" {\n    return errors.New(\"artifact config must set decompression_size_limit, e.g. \\\"1GB\\\"\")\n}","typeGuard":"func hasSizeLimit(a *ArtifactConfig) bool { return a.DecompressionSizeLimit != nil && *a.DecompressionSizeLimit != \"\" }","tryCatchPattern":null,"preventionTips":["Never leave size-limit keys unset when hand-editing agent config.","Make template renderers error on empty size-limit variables.","Base configs on DefaultArtifactConfig() and validate after overrides."],"tags":["nomad","config-validation","missing-field","decompression"],"backgroundTag":"missing-required-argument","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"}