{"record":{"id":"f51a8b371692ac9f","repo":"hashicorp/nomad","slug":"can-not-set-node-s-scheduling-eligibility-to-eligi","errorCode":null,"errorMessage":"can not set node's scheduling eligibility to eligible while it is draining","messagePattern":"can not set node's scheduling eligibility to eligible while it is draining","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/node_endpoint.go","lineNumber":1071,"sourceCode":"\tdefault:\n\t\treturn fmt.Errorf(\"invalid scheduling eligibility %q\", args.Eligibility)\n\t}\n\n\t// Look for the node\n\tsnap, err := n.srv.fsm.State().Snapshot()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnode, err := snap.NodeByID(nil, args.NodeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif node == nil {\n\t\treturn fmt.Errorf(\"node not found\")\n\t}\n\n\tif node.DrainStrategy != nil && args.Eligibility == structs.NodeSchedulingEligible {\n\t\treturn fmt.Errorf(\"can not set node's scheduling eligibility to eligible while it is draining\")\n\t}\n\n\tswitch args.Eligibility {\n\tcase structs.NodeSchedulingEligible, structs.NodeSchedulingIneligible:\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid scheduling eligibility %q\", args.Eligibility)\n\t}\n\n\t// Update the timestamp of when the node status was updated\n\targs.UpdatedAt = time.Now().Unix()\n\n\t// Construct the node event\n\targs.NodeEvent = structs.NewNodeEvent().SetSubsystem(structs.NodeEventSubsystemCluster)\n\tif node.SchedulingEligibility == args.Eligibility {\n\t\treturn nil // Nothing to do\n\t} else if args.Eligibility == structs.NodeSchedulingEligible {\n\t\tn.logger.Info(\"node transitioning to eligible state\", \"node_id\", node.ID)\n\t\targs.NodeEvent.SetMessage(NodeEligibilityEventEligible)","sourceCodeStart":1053,"sourceCodeEnd":1089,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/node_endpoint.go#L1053-L1089","documentation":"UpdateEligibility rejected the request because the target node currently has a DrainStrategy set; Nomad forbids marking a draining node as scheduling-eligible, since eligibility would let the scheduler place new work on a node being evacuated.","triggerScenarios":"Thrown at nomad/node_endpoint.go:1071 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Finish or cancel the drain (`nomad node drain -disable <node>`) and wait for the DrainStrategy to clear before setting eligibility to eligible","Set eligibility to ineligible instead if the intent is to keep the node out of scheduling during drain","Check `nomad node status <node>` to confirm drain state before retrying"],"exampleFix":null,"handlingStrategy":"validation","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"}