{"record":{"id":"7c5339f0395dae99","repo":"hashicorp/nomad","slug":"must-provide-the-nodeid","errorCode":null,"errorMessage":"Must provide the NodeID","messagePattern":"Must provide the NodeID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/status_endpoint.go","lineNumber":158,"sourceCode":"\treply.LastTerm, err = strconv.ParseUint(stats[\"last_log_term\"], 10, 64)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error parsing server's last_log_term value: %s\", err)\n\t}\n\n\treturn nil\n}\n\n// HasNodeConn returns whether the server has a connection to the requested\n// Node.\nfunc (s *Status) HasNodeConn(args *structs.NodeSpecificRequest, reply *structs.NodeConnQueryResponse) error {\n\t// note: we're intentionally throwing away any auth error here and only\n\t// authenticate so that we can measure rate metrics\n\ts.srv.Authenticate(s.ctx, args)\n\ts.srv.MeasureRPCRate(\"status\", structs.RateMetricRead, args)\n\n\t// Validate the args\n\tif args.NodeID == \"\" {\n\t\treturn errors.New(\"Must provide the NodeID\")\n\t}\n\n\tstate, ok := s.srv.getNodeConn(args.NodeID)\n\tif ok {\n\t\treply.Connected = true\n\t\treply.Established = state.Established\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":140,"sourceCodeEnd":169,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/status_endpoint.go#L140-L169","documentation":"This error is raised by the Status API HasNodeConn RPC on the agent's status endpoint. It is a request-validation error returned when the caller sends a NodeConnRequest without populating NodeID, which the endpoint requires to look up the connection state of a specific Nomad client node.","triggerScenarios":"Calling the Status.HasNodeConn RPC with args.NodeID == \"\" — e.g. constructing the request without setting NodeID, or forwarding an empty node identifier from a caller-side lookup.","commonSituations":"A tool or script queries node connectivity but the node ID variable is empty because the node is unregistered or the lookup returned nothing; a plugin/automation builds the RPC from an unset config value.","solutions":["Populate args.NodeID with a valid, non-empty node UUID before calling HasNodeConn","Look up the node ID first via the Nodes().List API if it is unknown","Fix upstream code that passes an empty/unset node identifier"],"exampleFix":"// before\nreply, err := client.Status().HasNodeConn(&api.QueryOptions{})\n// after\nnodeID := \"3f7c1b2a-...\"\nreply, err := client.Status().HasNodeConn(&api.QueryOptions{}) // ensure the RPC request carries NodeID = nodeID","handlingStrategy":"validation","validationCode":"if nodeID == \"\" {\n    return errors.New(\"HasNodeConn requires a non-empty NodeID\")\n}","typeGuard":"func hasNodeID(nodeID string) bool { return nodeID != \"\" }","tryCatchPattern":"err := hasNodeConn(nodeID)\nif err != nil && strings.Contains(err.Error(), \"Must provide the NodeID\") {\n    // fix request args and retry once with a resolved node ID\n    id, lerr := resolveNodeID()\n    if lerr == nil { err = hasNodeConn(id) }\n}","preventionTips":["Always resolve the node UUID via Nodes().List before calling HasNodeConn","Never build the request from unset config or environment variables without a check","Validate identifiers are non-empty at the call-site boundary"],"tags":["nomad","rpc","validation","node"],"backgroundTag":"missing-required-argument","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"}