hashicorp/nomad · error
decompression_size_limit is not a valid size: %w
Error message
decompression_size_limit is not a valid size: %w
What it means
Once non-nil, decompression_size_limit must parse as a byte size via humanize.ParseBytes. On parse failure Validate() wraps the error: 'decompression_size_limit is not a valid size: %w'. Valid formats include "10MB", "1GiB", "500kb"; arbitrary strings or numbers with unknown units fail.
Source
Thrown at nomad/structs/config/artifact.go:231
}
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
- Use a recognized unit string, e.g. decompression_size_limit = "1GB".
- Pre-check locally with humanize.ParseBytes(value) and fix until it returns nil error.
- If the source is a raw byte count, format it with humanize.Bytes(count) before assigning.
Example fix
// before
artifact {
decompression_size_limit = "1073741824"
}
// after
artifact {
decompression_size_limit = "1GB"
} Defensive patterns
Strategy: validation
Validate before calling
if _, err := humanize.ParseBytes(cfg.DecompressionSizeLimit); err != nil {
return fmt.Errorf("decompression_size_limit %q must be like '1GB' or '500MB': %w", cfg.DecompressionSizeLimit, err)
} Type guard
func validSizeLimit(s *string) bool {
if s == nil { return false }
_, err := humanize.ParseBytes(*s)
return err == nil
} Prevention
- Always include a binary/decimal unit suffix: "1GB", "512MB", "10GiB".
- Convert raw byte counts with humanize.Bytes() before writing them to config.
- Lint all *_size / *_limit fields with humanize.ParseBytes in CI.
When it happens
Trigger: Calling ArtifactConfig.Validate() when humanize.ParseBytes(*a.DecompressionSizeLimit) errors, e.g. "10 mega", "1 TB/year", "0x1000", or an empty string "".
Common situations: Writing plain integers without units ("1073741824" alone fails — humanize expects unit suffixes like "1GB"); mixing locales ("1,5 GB"); typos like "1GG"; users copying formats from unrelated tools.
Related errors
- decompression_file_count_limit must not be nil
- decompression_file_count_limit must be >= 0 but found %d
- decompression_size_limit must not be nil
- decompression_size_limit must be < %d but found %d
- failed to parse config:
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/f13abd9a2b56b57e.
Report an issue: GitHub.