{"record":{"id":"073699e9315b8f08","repo":"hashicorp/nomad","slug":"unknown-scheduler-s","errorCode":null,"errorMessage":"unknown scheduler '%s'","messagePattern":"unknown scheduler '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scheduler/scheduler.go","lineNumber":38,"sourceCode":"\n// BuiltinSchedulers contains the built in registered schedulers\n// which are available\nvar BuiltinSchedulers = map[string]structs.Factory{\n\t\"service\":  NewServiceScheduler,\n\t\"batch\":    NewBatchScheduler,\n\t\"system\":   NewSystemScheduler,\n\t\"sysbatch\": NewSysBatchScheduler,\n}\n\n// NewScheduler is used to instantiate and return a new scheduler\n// given the scheduler name, initial state, and planner.\nfunc NewScheduler(\n\tname string, logger log.Logger, eventsCh chan<- any, state structs.State, planner structs.Planner,\n) (structs.Scheduler, error) {\n\t// Lookup the factory function\n\tfactory, ok := BuiltinSchedulers[name]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unknown scheduler '%s'\", name)\n\t}\n\n\t// Instantiate the scheduler\n\tsched := factory(logger, eventsCh, state, planner)\n\treturn sched, nil\n}\n","sourceCodeStart":20,"sourceCodeEnd":45,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/scheduler/scheduler.go#L20-L45","documentation":"NewScheduler looks up the scheduler type name in the BuiltinSchedulers factory map and returns this error when the requested name is not a registered scheduler type. Nomad only supports a fixed set of scheduler names (e.g. 'service', 'batch', 'system', 'sysbatch'), so an unrecognized name means a bad scheduler type configuration.","triggerScenarios":"Calling NewScheduler (directly or via reconcileQueuedAllocations, Plan, or invokeScheduler in the leader worker loop) with a scheduler name that is not a key in BuiltinSchedulers — typically from a job with an unknown/typo'd scheduler type, or a custom scheduler name not registered.","commonSituations":"Typo in scheduler type; using a scheduler type from a newer Nomad version on an older binary (e.g. 'sysbatch' on pre-1.1 Nomad); third-party tooling constructing evaluations with invalid scheduler names.","solutions":["Check the scheduler name passed to NewScheduler; only 'service', 'batch', 'system', and 'sysbatch' are built in.","Fix the typo or invalid scheduler type in the job file or calling code.","Upgrade the Nomad binary if the job uses a scheduler type introduced after the running version (e.g. sysbatch needs Nomad >= 1.1).","If using a custom/enterprise scheduler, verify it is registered into BuiltinSchedulers at init time."],"exampleFix":"// before\neval.Type = \"batch-job\"\nsched, err := scheduler.NewScheduler(eval.Type, logger, eventsCh, state, planner)\n// after\neval.Type = \"batch\" // must be one of: service, batch, system, sysbatch\nsched, err := scheduler.NewScheduler(eval.Type, logger, eventsCh, state, planner)","handlingStrategy":"validation","validationCode":"valid := map[string]bool{\"service\": true, \"batch\": true, \"system\": true, \"sysbatch\": true}\nif !valid[schedulerName] {\n    return fmt.Errorf(\"scheduler %q is not a builtin scheduler\", schedulerName)\n}","typeGuard":"func isBuiltinScheduler(name string) bool {\n    _, ok := scheduler.BuiltinSchedulers[name]\n    return ok\n}","tryCatchPattern":"sched, err := scheduler.NewScheduler(name, logger, eventsCh, state, planner)\nif err != nil {\n    if strings.Contains(err.Error(), \"unknown scheduler\") {\n        return fmt.Errorf(\"invalid scheduler type %q; allowed: service, batch, system, sysbatch\", name)\n    }\n    return err\n}","preventionTips":["Validate job scheduler types against the running Nomad version's supported set before submit.","Pin client/server Nomad versions when using newer scheduler types like sysbatch.","Add schema validation for scheduler type in CI tooling that generates jobs.","Avoid hardcoding scheduler names; use constants."],"tags":["nomad","scheduler","configuration","invalid-argument"],"backgroundTag":"unknown-scheduler-type","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"}