{"record":{"id":"100ca4465af72684","repo":"hashicorp/nomad","slug":"total-count-was-greater-than-configured-job-max-co-100ca4","errorCode":null,"errorMessage":"total count was greater than configured job_max_count: %d > %d","messagePattern":"total count was greater than configured job_max_count: (.+?) > (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/job_endpoint_hooks.go","lineNumber":550,"sourceCode":"\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}\n\t\t\tfor _, s := range t.Services {\n\t\t\t\tserviceErrs := v.validateServiceIdentity(\n\t\t\t\t\ts, fmt.Sprintf(\"task %s\", t.Name), okForIdentity)\n\t\t\t\tmultierror.Append(validationErrors, serviceErrs)\n\t\t\t}\n\n\t\t\tvaultWarns, vaultErrs := v.validateVaultIdentity(t, okForIdentity)\n\t\t\tmultierror.Append(validationErrors, vaultErrs)\n\t\t\twarnings = append(warnings, vaultWarns...)\n\t\t}\n\t}\n\tif v.srv.config.JobMaxCount > 0 && totalCount > v.srv.config.JobMaxCount {\n\t\terr := fmt.Errorf(\"total count was greater than configured job_max_count: %d > %d\", totalCount, v.srv.config.JobMaxCount)\n\t\tmultierror.Append(validationErrors, err)\n\t}\n\n\treturn warnings, validationErrors.ErrorOrNil()\n}\n\nfunc (v *jobValidate) isEligibleForMultiIdentity() bool {\n\tif v.srv == nil || v.srv.serf == nil {\n\t\treturn true // handle tests w/o real servers safely\n\t}\n\treturn v.srv.peersCache.ServersMeetMinimumVersion(\n\t\tv.srv.Region(), minVersionMultiIdentities, true)\n}\n\nfunc (v *jobValidate) validateServiceIdentity(s *structs.Service, parent string, okForIdentity bool) error {\n\tif s.Identity != nil && !okForIdentity {\n\t\treturn fmt.Errorf(\"Service %s in %s cannot have an identity until all servers are upgraded to %s or later\",\n\t\t\ts.Name, parent, minVersionMultiIdentities)","sourceCodeStart":532,"sourceCodeEnd":568,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/job_endpoint_hooks.go#L532-L568","documentation":"The agent config option job_max_count caps the total task count a single job may request. When the summed count of all task groups (group count × tasks, as tallied by Validate) exceeds this cap, submission is rejected.","triggerScenarios":"Registering a job where totalCount (sum over task groups and tasks) exceeds the configured JobMaxCount (>0).","commonSituations":"Operators setting job_max_count low to protect the cluster; autoscaling-generated jobs with large group counts; runaway count values in templated jobs (e.g. count = ${var} defaulted huge).","solutions":["Lower the job's group/task counts to fit under job_max_count","Ask the operator to raise or unset job_max_count in server config if the limit is too restrictive","Split the workload across multiple jobs to stay under the per-job cap"],"exampleFix":"// before\ngroup \"web\" { count = 100 }\ngroup \"api\" { count = 50 }   # total 150 > job_max_count 100\n// after\ngroup \"web\" { count = 60 }\ngroup \"api\" { count = 40 }   # total 100 <= 100","handlingStrategy":"validation","validationCode":"total := 0\nfor _, tg := range job.TaskGroups { total += int(*tg.Count) * len(tg.Tasks) }\nif jobMaxCount > 0 && total > jobMaxCount {\n\treturn fmt.Errorf(\"total count %d exceeds job_max_count %d\", total, jobMaxCount)\n}","typeGuard":"func withinMaxCount(total, max int) bool { return max <= 0 || total <= max }","tryCatchPattern":null,"preventionTips":["Fetch server job_max_count before generating job specs","Cap templated counts and validate totals pre-submit","Split oversized workloads into multiple jobs by design"],"tags":["nomad","capacity-limits","job-spec","configuration"],"backgroundTag":"limit-exceeded","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"}