{"record":{"id":"54f050aa0fedb05d","repo":"hashicorp/nomad","slug":"set-the-interval-to-at-least-v-to-accommodate-v","errorCode":null,"errorMessage":"Set the interval to at least %v to accommodate %v attempts","messagePattern":"Set the interval to at least (.+?) to accommodate (.+?) attempts","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":6729,"sourceCode":"\t\t}\n\t}\n\treturn false\n}\n\nfunc (r *ReschedulePolicy) validateDelayParams() error {\n\tok, possibleAttempts, recommendedInterval := r.viableAttempts()\n\tif ok {\n\t\treturn nil\n\t}\n\tvar mErr multierror.Error\n\tif r.DelayFunction == \"constant\" {\n\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"Nomad can only make %v attempts in %v with initial delay %v and \"+\n\t\t\t\"delay function %q\", possibleAttempts, r.Interval, r.Delay, r.DelayFunction))\n\t} else {\n\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"Nomad can only make %v attempts in %v with initial delay %v, \"+\n\t\t\t\"delay function %q, and delay ceiling %v\", possibleAttempts, r.Interval, r.Delay, r.DelayFunction, r.MaxDelay))\n\t}\n\t_ = multierror.Append(&mErr, fmt.Errorf(\"Set the interval to at least %v to accommodate %v attempts\", recommendedInterval.Round(time.Second), r.Attempts))\n\treturn mErr.ErrorOrNil()\n}\n\nfunc (r *ReschedulePolicy) viableAttempts() (bool, int, time.Duration) {\n\tvar possibleAttempts int\n\tvar recommendedInterval time.Duration\n\tvalid := true\n\tswitch r.DelayFunction {\n\tcase \"constant\":\n\t\trecommendedInterval = time.Duration(r.Attempts) * r.Delay\n\t\tif r.Interval < recommendedInterval {\n\t\t\tpossibleAttempts = int(r.Interval / r.Delay)\n\t\t\tvalid = false\n\t\t}\n\tcase \"exponential\":\n\t\tfor i := 0; i < r.Attempts; i++ {\n\t\t\tnextDelay := time.Duration(math.Pow(2, float64(i))) * r.Delay\n\t\t\tif nextDelay > r.MaxDelay {","sourceCodeStart":6711,"sourceCodeEnd":6747,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L6711-L6747","documentation":"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.","triggerScenarios":"Always co-emitted with error 3141/3142 whenever ReschedulePolicy.Validate detects possibleAttempts < Attempts and delayPreCheck succeeded.","commonSituations":"Reading the full multierror output from `nomad job validate` or the API error and seeing this remediation hint alongside the attempts-mismatch error.","solutions":["Set interval to the recommendedInterval value printed in this error (rounded up to seconds).","Re-run job validation after changing the interval to confirm the policy passes.","Optionally adjust delay/delay_function/attempts instead if a smaller interval is required."],"exampleFix":"// before\nreschedule {\n  attempts = 3\n  interval = \"30m\"\n  delay    = \"15m\"\n  delay_function = \"constant\"\n}\n// after\nreschedule {\n  attempts = 3\n  interval = \"45m\"\n  delay    = \"15m\"\n  delay_function = \"constant\"\n}","handlingStrategy":"validation","validationCode":"// Parse the recommended interval from the validation error and apply it.\nre := regexp.MustCompile(`Set the interval to at least (\\S+)`)\nfunc applyRecommended(err error, p *structs.ReschedulePolicy) *structs.ReschedulePolicy {\n\tif m := re.FindStringSubmatch(err.Error()); m != nil {\n\t\tif d, e := time.ParseDuration(m[1]); e == nil {\n\t\t\tp.Interval = d\n\t\t}\n\t}\n\treturn p\n}","typeGuard":"func intervalMeetsRecommendation(p *structs.ReschedulePolicy, min time.Duration) bool {\n\treturn p.Unlimited || p.Interval >= min\n}","tryCatchPattern":"if err := policy.Validate(); err != nil {\n\tif m := re.FindStringSubmatch(err.Error()); m != nil {\n\t\t// apply m[1] as the new interval and resubmit\n\t}\n}","preventionTips":["Adopt the recommendedInterval from the error message directly.","After resizing interval, re-run validate to confirm all policy errors clear.","Keep a table of attempts/delay/interval combos your org approves.","Automate remediation by parsing this hint in job-submission tooling."],"tags":["nomad","go","validation","reschedule-policy","remediation"],"backgroundTag":"reschedule-attempts-exceed-interval","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}