hashicorp/nomad · error

s3_timeout must be set

Error message

s3_timeout must be set

What it means

ArtifactConfig.Validate() checks every artifact option for nil so that fully-populated configs are explicit. When a.S3Timeout is nil, meaning the s3_timeout field was never assigned, validation fails immediately with 's3_timeout must be set'. It is a completeness check, not a value check.

Source

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

		return fmt.Errorf("git_timeout must be set")
	}
	if v, err := time.ParseDuration(*a.GitTimeout); err != nil {
		return fmt.Errorf("git_timeout not a valid duration: %w", err)
	} else if v < 0 {
		return fmt.Errorf("git_timeout must be > 0")
	}

	if a.HgTimeout == nil {
		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 {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Add s3_timeout = "30m" (or another positive duration) to the artifact block.
  2. Initialize the struct with DefaultArtifactConfig() before overriding fields, so all pointer fields are non-nil.
  3. If merging configs, ensure defaults are applied last so absent keys inherit from DefaultArtifactConfig().

Example fix

// before
func newArtifactConfig() *ArtifactConfig {
  return &ArtifactConfig{} // S3Timeout nil
}
// after
func newArtifactConfig() *ArtifactConfig {
  c := DefaultArtifactConfig()
  c.S3Timeout = stringPtr("1h")
  return c
}
Defensive patterns

Strategy: validation

Validate before calling

if cfg.S3Timeout == nil {
    return errors.New("artifact config must set s3_timeout; start from DefaultArtifactConfig()")
}

Type guard

func hasS3Timeout(a *ArtifactConfig) bool { return a.S3Timeout != nil && *a.S3Timeout != "" }

Prevention

When it happens

Trigger: Calling ArtifactConfig.Validate() on an ArtifactConfig struct (or parsed config) where the s3_timeout key is absent, so a.S3Timeout remains a nil *string.

Common situations: Constructing ArtifactConfig manually in Go tests or plugins without using DefaultArtifactConfig(); older config files written before s3_timeout was introduced being loaded by a newer Nomad; partial config merges that drop the key instead of inheriting defaults.

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


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