hashicorp/nomad · error
Interval can not be less than %v (got %v)
Error message
Interval can not be less than %v (got %v)
What it means
RestartPolicy.Validate() enforces a minimum interval (RestartPolicyMinInterval, 1 minute by default). An interval smaller than this floor is rejected because restart throttling below that granularity is not supported.
Source
Thrown at nomad/structs/structs.go:6579
*nrp = *r
return nrp
}
func (r *RestartPolicy) Validate() error {
var mErr multierror.Error
switch r.Mode {
case RestartPolicyModeDelay, RestartPolicyModeFail:
default:
_ = multierror.Append(&mErr, fmt.Errorf("Unsupported restart mode: %q", r.Mode))
}
// Check for ambiguous/confusing settings
if r.Attempts == 0 && r.Mode != RestartPolicyModeFail {
_ = multierror.Append(&mErr, fmt.Errorf("Restart policy %q with %d attempts is ambiguous", r.Mode, r.Attempts))
}
if r.Interval.Nanoseconds() < RestartPolicyMinInterval.Nanoseconds() {
_ = multierror.Append(&mErr, fmt.Errorf("Interval can not be less than %v (got %v)", RestartPolicyMinInterval, r.Interval))
}
if time.Duration(r.Attempts)*r.Delay > r.Interval {
_ = multierror.Append(&mErr,
fmt.Errorf("Nomad can't restart the TaskGroup %v times in an interval of %v with a delay of %v", r.Attempts, r.Interval, r.Delay))
}
return mErr.ErrorOrNil()
}
func NewRestartPolicy(jobType string) *RestartPolicy {
switch jobType {
case JobTypeService, JobTypeSystem:
rp := DefaultServiceJobRestartPolicy
return &rp
case JobTypeBatch:
rp := DefaultBatchJobRestartPolicy
return &rp
}
return nilView on GitHub (pinned to 482b49bf1a)
Solutions
- Raise restart_policy.interval to at least the minimum (>= 1m; default is 30m).
- Verify duration units in HCL (e.g. "30m", not 30).
- Run `nomad job validate` to see the exact minimum printed in the error.
Example fix
// before
restart {
interval = "30s"
attempts = 2
delay = "15s"
}
// after
restart {
interval = "30m"
attempts = 2
delay = "15s"
} Defensive patterns
Strategy: validation
Validate before calling
if rp != nil && rp.Interval.Nanoseconds() < structs.RestartPolicyMinInterval.Nanoseconds() {
return fmt.Errorf("restart interval %v < minimum %v", rp.Interval, structs.RestartPolicyMinInterval)
} Prevention
- Always write durations with explicit units ("30m", not 30).
- Compare against structs.RestartPolicyMinInterval when generating policies.
- Keep defaults (interval 30m) unless you have a specific reason.
When it happens
Trigger: A restart block with interval set below the minimum (e.g. interval = "30s"), or interval parsed as plain seconds/zero due to a unit mistake in HCL or JSON job submission.
Common situations: Unit confusion ("30" meaning 30s instead of 30m), copy-pasting durations from configs using different units, or generating policies in code with time.Duration in the wrong magnitude.
Related errors
- Nomad can't restart the TaskGroup %v times in an interval of
- KillTimeout must be a positive value
- gcs_timeout not a valid duration: %w
- gcs_timeout must be > 0
- git_timeout not a valid duration: %w
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/843eedbb556444c0.
Report an issue: GitHub.