hashicorp/nomad · error
PreventRescheduleOnLost is deprecated and ignored in favor o
Error message
PreventRescheduleOnLost is deprecated and ignored in favor of Disconnect.Replace
What it means
TaskGroup.Validate rejects the deprecated task-group field PreventRescheduleOnLost. Its behavior was replaced by the `disconnect { replace = ... }` field, so any job still setting it fails validation. It is appended to the same multierror as the other deprecated disconnect-related fields.
Source
Thrown at nomad/structs/structs.go:7661
if u := tg.Update; u != nil {
// Check the counts are appropriate
if tg.Count > 1 && u.MaxParallel > tg.Count && !(j.IsMultiregion() && tg.Count == 0) {
mErr.Errors = append(mErr.Errors,
fmt.Errorf("Update max parallel count is greater than task group count (%d > %d). "+
"A destructive change would result in the simultaneous replacement of all allocations.", u.MaxParallel, tg.Count))
}
}
if tg.MaxClientDisconnect != nil {
mErr.Errors = append(mErr.Errors, errors.New("MaxClientDisconnect is deprecated and ignored in favor of Disconnect.LostAfter"))
}
if tg.StopAfterClientDisconnect != nil {
mErr.Errors = append(mErr.Errors, errors.New("StopAfterClientDisconnect is deprecated and ignored favor of Disconnect.StopOnClientAfter"))
}
if tg.PreventRescheduleOnLost {
mErr.Errors = append(mErr.Errors, errors.New("PreventRescheduleOnLost is deprecated and ignored in favor of Disconnect.Replace"))
}
// Warn about unbounded rescheduling which may cause thrashing if tasks have
// unlimited attempts and a low delay.
//
// The 5 second gate on the delay is used as this was the previous minimum
// value which did not produce a warning. It therefore feels like the right
// gate to use.
if rp := tg.ReschedulePolicy; rp != nil && rp.Unlimited && rp.Delay < 5*time.Second {
mErr.Errors = append(
mErr.Errors,
errors.New("Reschedule policy has unlimited attempts enabled and a low delay; reschedule thrashing possible"),
)
}
// Check for mbits network field
if len(tg.Networks) > 0 && tg.Networks[0].MBits > 0 {
mErr.Errors = append(mErr.Errors, fmt.Errorf("mbits has been deprecated as of Nomad 0.12.0. Please remove mbits from the network block"))View on GitHub (pinned to 482b49bf1a)
Solutions
- Remove prevent_reschedule_on_lost from the task group.
- Add `disconnect { replace = true }` (or false) to express the same intent.
- Validate the job with `nomad job validate` before submitting.
Example fix
// before
group "batch" {
prevent_reschedule_on_lost = true
}
// after
group "batch" {
disconnect {
replace = true
}
} Defensive patterns
Strategy: validation
Validate before calling
if strings.Contains(jobHCL, "prevent_reschedule_on_lost") {
return errors.New("deprecated field prevent_reschedule_on_lost; use disconnect { replace }")
} Type guard
func usesPreventRescheduleOnLost(tg *structs.TaskGroup) bool {
return tg.PreventRescheduleOnLost
} Prevention
- Migrate all job files to the disconnect block.
- Add deprecated-field checks to CI validation.
- Review Nomad upgrade notes before bumping cluster version.
When it happens
Trigger: Submitting a job whose group sets `prevent_reschedule_on_lost = true` (or false) on a Nomad version where the disconnect block supersedes it.
Common situations: Old job files carried forward across upgrades; documentation or modules generated before the disconnect block existed.
Related errors
- StopAfterClientDisconnect is deprecated and ignored favor of
- Disconnect cannot be configured with both lost_after and sto
- lost_after cannot be a negative duration
- stop_after cannot be a negative duration
- Missing job ID
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/5ccfede6f8819160.
Report an issue: GitHub.