hashicorp/nomad · error
decompression_size_limit must not be nil
Error message
decompression_size_limit must not be nil
What it means
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.
Source
Thrown at nomad/structs/config/artifact.go:228
if a.S3Timeout == nil {
return fmt.Errorf("s3_timeout must be set")
}
if v, err := time.ParseDuration(*a.S3Timeout); err != nil {
return fmt.Errorf("s3_timeout not a valid duration: %w", err)
} else if v < 0 {
return fmt.Errorf("s3_timeout must be > 0")
}
if a.DecompressionFileCountLimit == nil {
return fmt.Errorf("decompression_file_count_limit must not be nil")
}
if v := *a.DecompressionFileCountLimit; v < 0 {
return fmt.Errorf("decompression_file_count_limit must be >= 0 but found %d", v)
}
if a.DecompressionSizeLimit == nil {
return fmt.Errorf("decompression_size_limit must not be nil")
}
if v, err := humanize.ParseBytes(*a.DecompressionSizeLimit); err != nil {
return fmt.Errorf("decompression_size_limit is not a valid size: %w", err)
} else if v > math.MaxInt64 {
return fmt.Errorf("decompression_size_limit must be < %d but found %d", int64(math.MaxInt64), v)
}
if a.DisableArtifactInspection == nil {
return fmt.Errorf("disable_artifact_inspection must be set")
}
if a.DisableFilesystemIsolation == nil {
return fmt.Errorf("disable_filesystem_isolation must be set")
}
for _, p := range a.FilesystemIsolationExtraPaths {
if _, err := landlock.ParsePath(p); err != nil {
return fmt.Errorf("filesystem_isolation_extra_paths contains invalid lockdown path %q", p)View on GitHub (pinned to 482b49bf1a)
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.
Example fix
// before
artifact {
# decompression_size_limit missing
}
// after
artifact {
decompression_size_limit = "1GB"
} Defensive patterns
Strategy: validation
Validate before calling
if cfg.DecompressionSizeLimit == nil || *cfg.DecompressionSizeLimit == "" {
return errors.New("artifact config must set decompression_size_limit, e.g. \"1GB\"")
} Type guard
func hasSizeLimit(a *ArtifactConfig) bool { return a.DecompressionSizeLimit != nil && *a.DecompressionSizeLimit != "" } Prevention
- 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.
When it happens
Trigger: Calling ArtifactConfig.Validate() where a.DecompressionSizeLimit is a nil *string because the key is absent from the config source.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- decompression_file_count_limit must not be nil
- s3_timeout must be set
- decompression_file_count_limit must be >= 0 but found %d
- decompression_size_limit is not a valid size: %w
- decompression_size_limit must be < %d but found %d
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/271e3d43defe3e66.
Report an issue: GitHub.