hashicorp/nomad · error
job priority must be between [%d, %d]
Error message
job priority must be between [%d, %d]
What it means
Job priority must fall within the configured inclusive range. The server checks job.Priority against structs.JobMinPriority (0) and the server's job_max_priority / JobMaxPriority config; out-of-range values are rejected at validation.
Source
Thrown at nomad/job_endpoint_hooks.go:519
warnings = append(warnings, multi.Errors...)
} else {
warnings = append(warnings, jobWarnings)
}
}
// TODO: Validate the driver configurations. These had to be removed in 0.9
// to support driver plugins, but see issue: #XXXX for more info.
if job.Type == structs.JobTypeCore {
multierror.Append(validationErrors, fmt.Errorf("job type cannot be core"))
}
if len(job.Payload) != 0 {
multierror.Append(validationErrors, fmt.Errorf("job can't be submitted with a payload, only dispatched"))
}
if job.Priority < structs.JobMinPriority || job.Priority > v.srv.config.JobMaxPriority {
multierror.Append(validationErrors, fmt.Errorf("job priority must be between [%d, %d]", structs.JobMinPriority, v.srv.config.JobMaxPriority))
}
okForIdentity := v.isEligibleForMultiIdentity()
totalCount := 0
for _, tg := range job.TaskGroups {
totalCount += tg.Count
for _, s := range tg.Services {
serviceErrs := v.validateServiceIdentity(
s, fmt.Sprintf("task group %s", tg.Name), okForIdentity)
multierror.Append(validationErrors, serviceErrs)
}
for _, t := range tg.Tasks {
if len(t.Identities) > 1 && !okForIdentity {
multierror.Append(validationErrors, fmt.Errorf("tasks can only have 1 identity block until all servers are upgraded to %s or later", minVersionMultiIdentities))
}View on GitHub (pinned to 482b49bf1a)
Solutions
- Set priority within [0, server job_max_priority] (default max 100)
- Raise the server's job_max_priority in agent config if high priorities are genuinely needed
- Omit priority to use the default (50)
Example fix
// before
job "myapp" { priority = 500 }
// after
job "myapp" { priority = 90 } Defensive patterns
Strategy: validation
Validate before calling
if p := *job.Priority; p < 0 || p > 100 {
return fmt.Errorf("priority %d outside [0,100]", p)
} Type guard
func validPriority(p int, max int) bool { return p >= 0 && p <= max } Prevention
- Keep priority in [0,100] unless server config raises the cap
- Query server config for job_max_priority in tooling
- Omit priority to accept the default
When it happens
Trigger: Submitting a job whose Priority is negative or exceeds the server's configured JobMaxPriority (default 100).
Common situations: Hand-setting priority to values like 1000 copied from other schedulers; fleet-wide config lowered job_max_priority while old job templates keep high values; sign errors producing negative priorities.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- 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
- Job ID contains a space
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/659e5e89f2325660.
Report an issue: GitHub.