hashicorp/nomad · error

decompression_size_limit must be < %d but found %d

Error message

decompression_size_limit must be < %d but found %d

What it means

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'.

Source

Thrown at nomad/structs/config/artifact.go:233

		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)
		}
	}

	if a.SetEnvironmentVariables == nil {
		return fmt.Errorf("set_environment_variables must be set")

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set a realistic cap below MaxInt64, e.g. decompression_size_limit = "10GB".
  2. To effectively disable the cap, use the largest practical value such as "8EB" (below MaxInt64) rather than exceeding it.
  3. Clamp in code: if v > math.MaxInt64 { v = math.MaxInt64 } before assigning the string form.

Example fix

// before
artifact {
  decompression_size_limit = "10ZB"
}
// after
artifact {
  decompression_size_limit = "8EB"
}
Defensive patterns

Strategy: validation

Validate before calling

v, err := humanize.ParseBytes(cfg.DecompressionSizeLimit)
if err == nil && v > math.MaxInt64 {
    return fmt.Errorf("decompression_size_limit %q exceeds int64 max", cfg.DecompressionSizeLimit)
}

Type guard

func fitsInt64(s *string) bool {
    if s == nil { return false }
    v, err := humanize.ParseBytes(*s)
    return err == nil && v <= math.MaxInt64
}

Prevention

When it happens

Trigger: Calling ArtifactConfig.Validate() when humanize.ParseBytes(*a.DecompressionSizeLimit) succeeds but returns v > math.MaxInt64, e.g. "10EB" or "9223372036854775808B".

Common situations: 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.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/933db1de188a0d4e. Report an issue: GitHub.