hashicorp/nomad · error
decompression_file_count_limit must not be nil
Error message
decompression_file_count_limit must not be nil
What it means
Validate() requires decompression_file_count_limit to be explicitly present; a nil pointer fails with 'decompression_file_count_limit must not be nil'. Nomad uses this limit to cap how many files an artifact archive may contain during decompression (zip-slip / bomb protection).
Source
Thrown at nomad/structs/config/artifact.go:221
return fmt.Errorf("hg_timeout must be set")
}
if v, err := time.ParseDuration(*a.HgTimeout); err != nil {
return fmt.Errorf("hg_timeout not a valid duration: %w", err)
} else if v < 0 {
return fmt.Errorf("hg_timeout must be > 0")
}
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")
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Add decompression_file_count_limit = 10000 (or another suitable non-negative int) to the artifact block.
- Build the config from DefaultArtifactConfig() and override only what you need.
- Fix config merge logic so defaults fill absent keys instead of leaving nil pointers.
Example fix
// before
artifact {
# decompression_file_count_limit missing
}
// after
artifact {
decompression_file_count_limit = 10000
} Defensive patterns
Strategy: validation
Validate before calling
if cfg.DecompressionFileCountLimit == nil {
return errors.New("artifact config must set decompression_file_count_limit")
} Type guard
func hasFileCountLimit(a *ArtifactConfig) bool { return a.DecompressionFileCountLimit != nil && *a.DecompressionFileCountLimit >= 0 } Prevention
- Use DefaultArtifactConfig() as the base for all config construction.
- After Nomad upgrades, diff your artifact block against the new defaults.
- Fail fast in tests by calling Validate() on fixture configs.
When it happens
Trigger: Calling ArtifactConfig.Validate() on a struct where the decompression_file_count_limit key is missing, leaving a.DecompressionFileCountLimit as nil *int.
Common situations: Manually built ArtifactConfig structs in tests/plugins; pre-existing config files from Nomad versions before this limit existed; template engines that omit keys with unset variables; partial merges dropping the field.
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_size_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/d2bccd0325bed912.
Report an issue: GitHub.