{"record":{"id":"9d29db65409dc33e","repo":"hashicorp/nomad","slug":"scheduler-resulted-in-an-unexpected-number-of-eval","errorCode":null,"errorMessage":"scheduler resulted in an unexpected number of eval updates: %v","messagePattern":"scheduler resulted in an unexpected number of eval updates: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/job_endpoint.go","lineNumber":1925,"sourceCode":"\tif plans := len(planner.Plans); plans != 1 {\n\t\treturn fmt.Errorf(\"scheduler resulted in an unexpected number of plans: %v\", plans)\n\t}\n\tannotations := planner.Plans[0].Annotations\n\tif args.Diff {\n\t\tjobDiff, err := existingJob.Diff(args.Job, true)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create job diff: %v\", err)\n\t\t}\n\n\t\tif err := scheduler.Annotate(jobDiff, annotations); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to annotate job diff: %v\", err)\n\t\t}\n\t\treply.Diff = jobDiff\n\t}\n\n\t// Grab the failures\n\tif len(planner.Evals) != 1 {\n\t\treturn fmt.Errorf(\"scheduler resulted in an unexpected number of eval updates: %v\", planner.Evals)\n\t}\n\tupdatedEval := planner.Evals[0]\n\n\t// If it is a periodic job calculate the next launch\n\tif args.Job.IsPeriodic() && args.Job.Periodic.Enabled {\n\t\treply.NextPeriodicLaunch, err = args.Job.Periodic.Next(time.Now().In(args.Job.Periodic.GetLocation()))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to parse cron expression: %v\", err)\n\t\t}\n\t}\n\n\treply.FailedTGAllocs = updatedEval.FailedTGAllocs\n\treply.JobModifyIndex = index\n\treply.Annotations = annotations\n\treply.CreatedEvals = planner.CreateEvals\n\treply.Index = index\n\treturn nil\n}","sourceCodeStart":1907,"sourceCodeEnd":1943,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/job_endpoint.go#L1907-L1943","documentation":"Fires in Job.Plan when the dry-run scheduler did not produce exactly one evaluation update; this is an internal invariant violation (planner mock got an unexpected count), usually indicating a scheduler bug rather than user error.","triggerScenarios":"Thrown at nomad/job_endpoint.go:1925 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the plan on a healthy server","Report as a bug with the job spec and Nomad version if reproducible"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}