{"record":{"id":"fff5b87a7771ee3f","repo":"hashicorp/nomad","slug":"system-or-sysbatch-jobs-should-not-have-a-reschedu","errorCode":null,"errorMessage":"System or sysbatch jobs should not have a reschedule policy","messagePattern":"System or sysbatch jobs should not have a reschedule policy","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":7202,"sourceCode":"\t\tmErr = multierror.Append(mErr, fmt.Errorf(\"Task Group %v should have a restart policy\", tg.Name))\n\t}\n\n\tif j.Type == JobTypeSystem {\n\t\tif tg.Spreads != nil {\n\t\t\tmErr = multierror.Append(mErr, fmt.Errorf(\"System jobs may not have a spread block\"))\n\t\t}\n\t} else {\n\t\tfor idx, spread := range tg.Spreads {\n\t\t\tif err := spread.Validate(); err != nil {\n\t\t\t\touter := fmt.Errorf(\"Spread %d validation failed: %s\", idx+1, err)\n\t\t\t\tmErr = multierror.Append(mErr, outer)\n\t\t\t}\n\t\t}\n\t}\n\n\tif j.Type == JobTypeSystem || j.Type == JobTypeSysBatch {\n\t\tif tg.ReschedulePolicy != nil {\n\t\t\tmErr = multierror.Append(mErr, fmt.Errorf(\"System or sysbatch jobs should not have a reschedule policy\"))\n\t\t}\n\t} else {\n\t\tif tg.ReschedulePolicy != nil {\n\t\t\tif err := tg.ReschedulePolicy.Validate(); err != nil {\n\t\t\t\tmErr = multierror.Append(mErr, err)\n\t\t\t}\n\t\t} else {\n\t\t\tmErr = multierror.Append(mErr, fmt.Errorf(\"Task Group %v should have a reschedule policy\", tg.Name))\n\t\t}\n\t}\n\n\tif tg.EphemeralDisk != nil {\n\t\tif err := tg.EphemeralDisk.Validate(); err != nil {\n\t\t\tmErr = multierror.Append(mErr, err)\n\t\t}\n\t} else {\n\t\tmErr = multierror.Append(mErr, fmt.Errorf(\"Task Group %v should have an ephemeral disk object\", tg.Name))\n\t}","sourceCodeStart":7184,"sourceCodeEnd":7220,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L7184-L7220","documentation":"Nomad validation rejects a reschedule policy on System or SysBatch jobs. These job types run one allocation per eligible node and are not re-placed by the scheduler after failures, so a `reschedule` stanza has no effect and is considered a configuration error. Detected when `j.Type` is `JobTypeSystem` or `JobTypeSysBatch` and `tg.ReschedulePolicy != nil`.","triggerScenarios":"Submitting a job with `type = \"system\"` or `type = \"sysbatch\"` whose task group defines a `reschedule { ... }` stanza, or where reschedule policy is set programmatically on the group.","commonSituations":"Converting a service job to system/sysbatch without stripping the reschedule block; shared base group templates that include reschedule for all job types; older job files carried forward across job-type changes.","solutions":["Remove the `reschedule` block from each task group in the system/sysbatch job.","If rescheduling on failure is required, use a `service` (or `batch`) job type instead.","Validate the job spec with `nomad job validate` before submission."],"exampleFix":"// before\njob \"backup\" {\n  type = \"sysbatch\"\n  group \"backup\" {\n    reschedule {\n      attempts = 3\n      interval = \"10m\"\n    }\n  }\n}\n// after\njob \"backup\" {\n  type = \"sysbatch\"\n  group \"backup\" {\n  }\n}","handlingStrategy":"validation","validationCode":"func validateNoRescheduleOnSystem(j *api.Job) error {\n\tif j == nil {\n\t\treturn nil\n\t}\n\tif *j.Type == \"system\" || *j.Type == \"sysbatch\" {\n\t\tfor _, tg := range j.TaskGroups {\n\t\t\tif tg.ReschedulePolicy != nil && *tg.ReschedulePolicy != (api.ReschedulePolicy{}) {\n\t\t\t\treturn fmt.Errorf(\"group %s: system/sysbatch jobs should not have a reschedule policy\", *tg.Name)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":"func isSystemFamily(j *api.Job) bool { return j != nil && (*j.Type == \"system\" || *j.Type == \"sysbatch\") }","tryCatchPattern":null,"preventionTips":["Strip lifecycle stanzas (reschedule, spread) when changing a job's type.","Use separate HCL templates per job type instead of one shared template.","Add a pre-submit validation step in CI pipelines."],"tags":["nomad","job-validation","system-jobs","reschedule"],"backgroundTag":"invalid-job-spec","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"}