hashicorp/nomad · error

http_max_size must be set

Error message

http_max_size must be set

What it means

ArtifactConfig.Validate requires the http_max_size option to be set; like http_read_timeout it is a *string, so absence of the key yields a nil pointer and this error. http_max_size bounds the maximum size of downloaded artifacts, and Nomad considers the artifact config incomplete without it.

Source

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

	return true
}

func (a *ArtifactConfig) Validate() error {
	if a == nil {
		return fmt.Errorf("artifact must not be nil")
	}

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

	if a.HTTPMaxSize == nil {
		return fmt.Errorf("http_max_size must be set")
	}
	if v, err := humanize.ParseBytes(*a.HTTPMaxSize); err != nil {
		return fmt.Errorf("http_max_size not a valid size: %w", err)
	} else if v > math.MaxInt64 {
		return fmt.Errorf("http_max_size must be < %d but found %d", int64(math.MaxInt64), v)
	}

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

	if a.GitTimeout == nil {
		return fmt.Errorf("git_timeout must be set")

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Add http_max_size to the artifact block, e.g. artifact { http_max_size = "1g" }.
  2. Regenerate the client config from the current Nomad default template which includes artifact defaults.
  3. If constructing ArtifactConfig in Go, set HTTPMaxSize to a valid byte-size string before Validate.
  4. Diff the failing config against a known-good one from the same Nomad version.

Example fix

// before (HCL)
artifact {
  http_read_timeout = "30s"
}
// after
artifact {
  http_read_timeout = "30s"
  http_max_size     = "1g"
}
Defensive patterns

Strategy: validation

Validate before calling

if cfg.Artifact.HTTPMaxSize == nil {
    cfg.Artifact.HTTPMaxSize = ptr.Of("1g")
}
if _, err := humanize.ParseBytes(*cfg.Artifact.HTTPMaxSize); err != nil {
    return fmt.Errorf("http_max_size invalid: %w", err)
}

Try / catch

if err := cfg.Artifact.Validate(); err != nil {
    if strings.Contains(err.Error(), "http_max_size must be set") {
        // add http_max_size to the artifact block
    }
    return err
}

Prevention

When it happens

Trigger: Starting a Nomad client whose artifact config block omits http_max_size, so ArtifactConfig.HTTPMaxSize remains nil during agent startup validation.

Common situations: Old agent configs predating the http_max_size option; config templates from provisioning tools that predate the option; manually trimmed configs that kept http_read_timeout but dropped http_max_size.

Related errors


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