{"record":{"id":"659e5e89f2325660","repo":"hashicorp/nomad","slug":"job-priority-must-be-between-d-d","errorCode":null,"errorMessage":"job priority must be between [%d, %d]","messagePattern":"job priority must be between \\[(.+?), (.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/job_endpoint_hooks.go","lineNumber":519,"sourceCode":"\t\t\twarnings = append(warnings, multi.Errors...)\n\t\t} else {\n\t\t\twarnings = append(warnings, jobWarnings)\n\t\t}\n\t}\n\n\t// TODO: Validate the driver configurations. These had to be removed in 0.9\n\t//       to support driver plugins, but see issue: #XXXX for more info.\n\n\tif job.Type == structs.JobTypeCore {\n\t\tmultierror.Append(validationErrors, fmt.Errorf(\"job type cannot be core\"))\n\t}\n\n\tif len(job.Payload) != 0 {\n\t\tmultierror.Append(validationErrors, fmt.Errorf(\"job can't be submitted with a payload, only dispatched\"))\n\t}\n\n\tif job.Priority < structs.JobMinPriority || job.Priority > v.srv.config.JobMaxPriority {\n\t\tmultierror.Append(validationErrors, fmt.Errorf(\"job priority must be between [%d, %d]\", structs.JobMinPriority, v.srv.config.JobMaxPriority))\n\t}\n\n\tokForIdentity := v.isEligibleForMultiIdentity()\n\n\ttotalCount := 0\n\tfor _, tg := range job.TaskGroups {\n\t\ttotalCount += tg.Count\n\n\t\tfor _, s := range tg.Services {\n\t\t\tserviceErrs := v.validateServiceIdentity(\n\t\t\t\ts, fmt.Sprintf(\"task group %s\", tg.Name), okForIdentity)\n\t\t\tmultierror.Append(validationErrors, serviceErrs)\n\t\t}\n\n\t\tfor _, t := range tg.Tasks {\n\t\t\tif len(t.Identities) > 1 && !okForIdentity {\n\t\t\t\tmultierror.Append(validationErrors, fmt.Errorf(\"tasks can only have 1 identity block until all servers are upgraded to %s or later\", minVersionMultiIdentities))\n\t\t\t}","sourceCodeStart":501,"sourceCodeEnd":537,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/job_endpoint_hooks.go#L501-L537","documentation":"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.","triggerScenarios":"Submitting a job whose Priority is negative or exceeds the server's configured JobMaxPriority (default 100).","commonSituations":"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.","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)"],"exampleFix":"// before\njob \"myapp\" { priority = 500 }\n// after\njob \"myapp\" { priority = 90 }","handlingStrategy":"validation","validationCode":"if p := *job.Priority; p < 0 || p > 100 {\n\treturn fmt.Errorf(\"priority %d outside [0,100]\", p)\n}","typeGuard":"func validPriority(p int, max int) bool { return p >= 0 && p <= max }","tryCatchPattern":null,"preventionTips":["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"],"tags":["nomad","job-spec","priority","validation"],"backgroundTag":"value-out-of-range","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"}