hashicorp/nomad · error

missing node ID for drain update

Error message

missing node ID for drain update

What it means

Guard in Node.UpdateDrain: the drain update request carries an empty NodeID, so the drain strategy cannot be applied to any node.

Solutions

  1. Supply the target node's ID in the drain request
  2. Use nomad node drain which fills in the ID
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nomad/node_endpoint.go:926 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/d1f9ac3b94cb299b. Report an issue: GitHub.

Appendix: source

Thrown at nomad/node_endpoint.go:926

	if done, err := n.srv.forward("Node.UpdateDrain", args, args, reply); done {
		return err
	}
	n.srv.MeasureRPCRate("node", structs.RateMetricWrite, args)
	if authErr != nil {
		return structs.ErrPermissionDenied
	}
	defer metrics.MeasureSince([]string{"nomad", "client", "update_drain"}, time.Now())

	// Check node write permissions
	if aclObj, err := n.srv.ResolveACL(args); err != nil {
		return err
	} else if err := n.checkNodeDrainAuth(aclObj, args); err != nil {
		return err
	}

	// Verify the arguments
	if args.NodeID == "" {
		return fmt.Errorf("missing node ID for drain update")
	}
	if args.NodeEvent != nil {
		return fmt.Errorf("node event must not be set")
	}

	// The AuthenticatedIdentity is unexported so won't be written via
	// Raft. Record the identity string so it can be written to LastDrain
	args.UpdatedBy = args.GetIdentity().String()

	snap, err := n.srv.fsm.State().Snapshot()
	if err != nil {
		return err
	}
	node, err := snap.NodeByID(nil, args.NodeID)
	if err != nil {
		return err
	}
	if node == nil {

View on GitHub (pinned to 482b49bf1a)