hashicorp/nomad · error

Set the interval to at least %v to accommodate %v attempts

Error message

Set the interval to at least %v to accommodate %v attempts

What it means

This is the advisory companion error appended after the 'Nomad can only make N attempts...' error. viableAttempts() returns a recommendedInterval — the minimum Interval needed to fit Attempts retries under the configured delay schedule — and Validate tells you to set interval to at least that value (rounded to seconds). It is part of the same multierror, not a separate failure.

Source

Thrown at nomad/structs/structs.go:6729

		}
	}
	return false
}

func (r *ReschedulePolicy) validateDelayParams() error {
	ok, possibleAttempts, recommendedInterval := r.viableAttempts()
	if ok {
		return nil
	}
	var mErr multierror.Error
	if r.DelayFunction == "constant" {
		_ = multierror.Append(&mErr, fmt.Errorf("Nomad can only make %v attempts in %v with initial delay %v and "+
			"delay function %q", possibleAttempts, r.Interval, r.Delay, r.DelayFunction))
	} else {
		_ = multierror.Append(&mErr, fmt.Errorf("Nomad can only make %v attempts in %v with initial delay %v, "+
			"delay function %q, and delay ceiling %v", possibleAttempts, r.Interval, r.Delay, r.DelayFunction, r.MaxDelay))
	}
	_ = multierror.Append(&mErr, fmt.Errorf("Set the interval to at least %v to accommodate %v attempts", recommendedInterval.Round(time.Second), r.Attempts))
	return mErr.ErrorOrNil()
}

func (r *ReschedulePolicy) viableAttempts() (bool, int, time.Duration) {
	var possibleAttempts int
	var recommendedInterval time.Duration
	valid := true
	switch r.DelayFunction {
	case "constant":
		recommendedInterval = time.Duration(r.Attempts) * r.Delay
		if r.Interval < recommendedInterval {
			possibleAttempts = int(r.Interval / r.Delay)
			valid = false
		}
	case "exponential":
		for i := 0; i < r.Attempts; i++ {
			nextDelay := time.Duration(math.Pow(2, float64(i))) * r.Delay
			if nextDelay > r.MaxDelay {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set interval to the recommendedInterval value printed in this error (rounded up to seconds).
  2. Re-run job validation after changing the interval to confirm the policy passes.
  3. Optionally adjust delay/delay_function/attempts instead if a smaller interval is required.

Example fix

// before
reschedule {
  attempts = 3
  interval = "30m"
  delay    = "15m"
  delay_function = "constant"
}
// after
reschedule {
  attempts = 3
  interval = "45m"
  delay    = "15m"
  delay_function = "constant"
}
Defensive patterns

Strategy: validation

Validate before calling

// Parse the recommended interval from the validation error and apply it.
re := regexp.MustCompile(`Set the interval to at least (\S+)`)
func applyRecommended(err error, p *structs.ReschedulePolicy) *structs.ReschedulePolicy {
	if m := re.FindStringSubmatch(err.Error()); m != nil {
		if d, e := time.ParseDuration(m[1]); e == nil {
			p.Interval = d
		}
	}
	return p
}

Type guard

func intervalMeetsRecommendation(p *structs.ReschedulePolicy, min time.Duration) bool {
	return p.Unlimited || p.Interval >= min
}

Try / catch

if err := policy.Validate(); err != nil {
	if m := re.FindStringSubmatch(err.Error()); m != nil {
		// apply m[1] as the new interval and resubmit
	}
}

Prevention

When it happens

Trigger: Always co-emitted with error 3141/3142 whenever ReschedulePolicy.Validate detects possibleAttempts < Attempts and delayPreCheck succeeded.

Common situations: Reading the full multierror output from `nomad job validate` or the API error and seeing this remediation hint alongside the attempts-mismatch error.

Related errors


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