hashicorp/nomad · error
job_max_priority cannot be %d. Must be between %d and %d
Error message
job_max_priority cannot be %d. Must be between %d and %d
What it means
Nomad jobs carry priorities in [JobDefaultMaxPriority? — specifically between structs.JobDefaultMaxPriority (1) and structs.JobMaxPriority (2048)]. convertServerConfig validates server.job_max_priority against this inclusive range, rejecting 0 and out-of-range values.
Source
Thrown at command/agent/agent.go:364
if agentConfig.Autopilot.MinQuorum != 0 {
conf.AutopilotConfig.MinQuorum = uint(agentConfig.Autopilot.MinQuorum)
}
if agentConfig.Autopilot.EnableRedundancyZones != nil {
conf.AutopilotConfig.EnableRedundancyZones = *agentConfig.Autopilot.EnableRedundancyZones
}
if agentConfig.Autopilot.DisableUpgradeMigration != nil {
conf.AutopilotConfig.DisableUpgradeMigration = *agentConfig.Autopilot.DisableUpgradeMigration
}
if agentConfig.Autopilot.EnableCustomUpgrades != nil {
conf.AutopilotConfig.EnableCustomUpgrades = *agentConfig.Autopilot.EnableCustomUpgrades
}
}
jobMaxPriority := structs.JobDefaultMaxPriority
if agentConfig.Server.JobMaxPriority != nil && *agentConfig.Server.JobMaxPriority != 0 {
jobMaxPriority = *agentConfig.Server.JobMaxPriority
if jobMaxPriority < structs.JobDefaultMaxPriority || jobMaxPriority > structs.JobMaxPriority {
return nil, fmt.Errorf("job_max_priority cannot be %d. Must be between %d and %d", *agentConfig.Server.JobMaxPriority, structs.JobDefaultMaxPriority, structs.JobMaxPriority)
}
}
jobDefaultPriority := structs.JobDefaultPriority
if agentConfig.Server.JobDefaultPriority != nil && *agentConfig.Server.JobDefaultPriority != 0 {
jobDefaultPriority = *agentConfig.Server.JobDefaultPriority
if jobDefaultPriority < structs.JobDefaultPriority || jobDefaultPriority >= jobMaxPriority {
return nil, fmt.Errorf("job_default_priority cannot be %d. Must be between %d and %d", *agentConfig.Server.JobDefaultPriority, structs.JobDefaultPriority, jobMaxPriority)
}
}
conf.JobMaxPriority = jobMaxPriority
conf.JobDefaultPriority = jobDefaultPriority
jobMaxCount := structs.JobDefaultMaxCount
if agentConfig.Server.JobMaxCount != nil {
jobMaxCount = *agentConfig.Server.JobMaxCount
if jobMaxCount < 0 {
return nil, fmt.Errorf("job_max_count (%d) cannot be negative", jobMaxCount)
}View on GitHub (pinned to 482b49bf1a)
Solutions
- Set job_max_priority within [1, 2048] (structs.JobDefaultMaxPriority..structs.JobMaxPriority).
- Remove the stanza to keep the default max of 100.
- If 0 was intended as 'default', simply omit the option (0 is treated as unset).
Example fix
// before
server {
job_max_priority = 5000
}
// after
server {
job_max_priority = 2048
} Defensive patterns
Strategy: validation
Validate before calling
// Go: pre-validate with structs constants
if p := cfg.Server.JobMaxPriority; p != nil && *p != 0 &&
(*p < structs.JobDefaultMaxPriority || *p > structs.JobMaxPriority) {
return fmt.Errorf("job_max_priority %d outside [%d,%d]", *p, structs.JobDefaultMaxPriority, structs.JobMaxPriority)
} Try / catch
conf, err := convertServerConfig(agentCfg)
if err != nil {
if strings.Contains(err.Error(), "job_max_priority cannot be") {
return fmt.Errorf("job_max_priority must be within the allowed priority range: %w", err)
}
return err
} Prevention
- Keep job_max_priority within [1, 2048]; default cap is 100.
- Treat 0 as unset — omit the option instead.
- Reference the structs constants rather than hardcoding numbers in tooling.
When it happens
Trigger: Setting server { job_max_priority = N } where N != 0 and (N < structs.JobDefaultMaxPriority or N > structs.JobMaxPriority) during agent start or reload.
Common situations: Clusters needing higher-than-default max priority (default 100) setting the cap too high above 2048; typos or unit confusion (e.g. 20000); templating bugs passing 0 to mean 'unlimited'.
Related errors
- job_default_priority cannot be %d. Must be between %d and %d
- wait config is nil or empty
- missing datacenter for client registration
- default_identity_ttl must be greater than 0
- max_identity_ttl must be greater than 0
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/08d1576a08f174f7.
Report an issue: GitHub.