hashicorp/terraform · error

invalid retry_wait_min

Error message

invalid retry_wait_min: %s

What it means

backendbase.IntValue failed to convert the retry_wait_min value (attribute or TF_HTTP_RETRY_WAIT_MIN, default 1 second) to an int. Same constraints as retry_max: must be a whole number; fractional, NaN, Infinity, or out-of-range values are rejected.

Solutions

  1. Set retry_wait_min to a non-negative integer representing seconds (e.g. retry_wait_min = 1).
  2. Remove the setting to use the default of 1 second.
  3. Keep retry_wait_min <= retry_wait_max to avoid configuration surprises.

Example fix

// before
retry_wait_min = 0.5
// after
retry_wait_min = 1
Defensive patterns

Strategy: validation

Validate before calling

# Pre-flight: retry_wait_min must be a non-negative integer (seconds)
if [ -n "$TF_HTTP_RETRY_WAIT_MIN" ]; then
  case "$TF_HTTP_RETRY_WAIT_MIN" in
    ''|*[!0-9]*) echo "ERROR: retry_wait_min must be a non-negative integer, got: $TF_HTTP_RETRY_WAIT_MIN"; exit 1 ;;
  esac
fi

Prevention

When it happens

Trigger: retry_wait_min set to a fractional number (0.5), NaN/Infinity, or a huge value exceeding int range.

Common situations: User wants sub-second waits and sets retry_wait_min = 0.5; a computed expression yields a float.

Related errors


AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11). Data as JSON: /api/errors/a89000623bc761c2. Report an issue: GitHub.

Appendix: source

Thrown at internal/backend/remote-state/http/backend.go:206

		backendbase.GetAttrEnvDefaultFallback(
			configVal, "retry_max",
			"TF_HTTP_RETRY_MAX", cty.NumberIntVal(2),
		),
	)
	if err != nil {
		return backendbase.ErrorAsDiagnostics(
			fmt.Errorf("invalid retry_max: %s", err),
		)
	}
	retryWaitMin, err := backendbase.IntValue(
		backendbase.GetAttrEnvDefaultFallback(
			configVal, "retry_wait_min",
			"TF_HTTP_RETRY_WAIT_MIN", cty.NumberIntVal(1),
		),
	)
	if err != nil {
		return backendbase.ErrorAsDiagnostics(
			fmt.Errorf("invalid retry_wait_min: %s", err),
		)
	}
	retryWaitMax, err := backendbase.IntValue(
		backendbase.GetAttrEnvDefaultFallback(
			configVal, "retry_wait_max",
			"TF_HTTP_RETRY_WAIT_MAX", cty.NumberIntVal(30),
		),
	)
	if err != nil {
		return backendbase.ErrorAsDiagnostics(
			fmt.Errorf("invalid retry_wait_max: %s", err),
		)
	}

	rClient := retryablehttp.NewClient()
	rClient.RetryMax = int(retryMax)
	rClient.RetryWaitMin = time.Duration(retryWaitMin) * time.Second
	rClient.RetryWaitMax = time.Duration(retryWaitMax) * time.Second

View on GitHub (pinned to d32a084675)