{"record":{"id":"cd8c1f9611683d36","repo":"hashicorp/nomad","slug":"failed-to-get-scheduler-configuration-v","errorCode":null,"errorMessage":"failed to get scheduler configuration: %v","messagePattern":"failed to get scheduler configuration: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scheduler/generic_sched.go","lineNumber":804,"sourceCode":"\t\t\tplan.NodeAllocation[original.NodeID][i] = updated\n\t\t\treturn\n\t\t}\n\t}\n}\n\n// setJob updates the stack with the given job and job's node pool scheduler\n// configuration.\nfunc (s *GenericScheduler) setJob(job *structs.Job) error {\n\t// Fetch node pool and global scheduler configuration to determine how to\n\t// configure the scheduler.\n\tpool, err := s.state.NodePoolByName(nil, job.NodePool)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get job node pool %q: %v\", job.NodePool, err)\n\t}\n\n\t_, schedConfig, err := s.state.SchedulerConfig()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get scheduler configuration: %v\", err)\n\t}\n\n\ts.stack.SetJob(job)\n\ts.stack.SetSchedulerConfiguration(schedConfig.WithNodePool(pool))\n\treturn nil\n}\n\n// setnodes updates the stack with the nodes that are ready for placement for\n// the given job.\nfunc (s *GenericScheduler) setNodes(job *structs.Job) ([]*structs.Node, map[string]int, error) {\n\tnodes, _, byDC, err := readyNodesInDCsAndPool(s.state, job.Datacenters, job.NodePool)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\ts.stack.SetNodes(nodes)\n\treturn nodes, byDC, nil\n}","sourceCodeStart":786,"sourceCodeEnd":822,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/scheduler/generic_sched.go#L786-L822","documentation":"This error is returned by the scheduler's setJob helper (scheduler/generic_sched.go) when the state store's SchedulerConfig() call fails while configuring the scheduler for a job. It means the scheduler could not read the global scheduler configuration needed to set up the scheduling stack (after successfully fetching the job's node pool). The wrapped %v carries the underlying state-store error.","triggerScenarios":"An evaluation is processed via process/computePlacements, setJob is invoked, NodePoolByName succeeds, but s.state.SchedulerConfig() returns a non-nil error (state store read failure, corrupted or missing scheduler config entry, or Raft/state backend I/O error).","commonSituations":"Nomad servers with a degraded or corrupt state store; scheduler config not yet initialized during early cluster bootstrap or restore from backup; disk/raft issues on the leader while a scheduler worker is evaluating a queued job.","solutions":["Inspect the wrapped cause (%v) to identify the state-store error and check server logs for the underlying raft/state store failure.","Verify the leader is healthy and the state store is intact; run nomad server members and check for raft errors.","Restart the affected Nomad server agent; if state is corrupt, restore from a verified backup.","Re-trigger evaluation by retrying the job (nomad job eval <job>) once the state store is healthy.","Upgrade Nomad to the latest patch release if the state store bug persists."],"exampleFix":"// Server-side fix is operational; client retry pattern\n// before\nerr := scheduler.Process(eval)\nif err != nil { return err }\n// after\nif err := scheduler.Process(eval); err != nil {\n    if strings.Contains(err.Error(), \"failed to get scheduler configuration\") {\n        time.Sleep(backoff)\n        return scheduler.Process(eval) // retry after state store recovers\n    }\n    return err\n}","handlingStrategy":"retry","validationCode":"// preflight: verify state store is reachable and config exists\nif _, cfg, err := state.SchedulerConfig(); err != nil {\n    return fmt.Errorf(\"state store not ready: %w\", err)\n}","typeGuard":"func schedulerConfigReadable(s structs.State) bool {\n    _, _, err := s.SchedulerConfig()\n    return err == nil\n}","tryCatchPattern":"if err := sched.Process(eval); err != nil {\n    if strings.Contains(err.Error(), \"failed to get scheduler configuration\") {\n        // retry with backoff; state store likely transiently unavailable\n        return retryWithBackoff(func() error { return sched.Process(eval) })\n    }\n    return err\n}","preventionTips":["Monitor Nomad server raft and state-store health metrics.","Keep servers patched to the latest stable Nomad version.","Back up and verify the server data directory regularly.","Alert on leader elections and raft I/O errors."],"tags":["nomad","scheduler","state-store","configuration"],"backgroundTag":"state-store-read-failed","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"}