{"record":{"id":"0287281595f677f6","repo":"hashicorp/nomad","slug":"missing-node-id","errorCode":null,"errorMessage":"missing node ID","messagePattern":"missing node ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/node_endpoint.go","lineNumber":1371,"sourceCode":"\tif done, err := n.srv.forward(\"Node.GetClientAllocs\", args, args, reply); done {\n\t\t// We have a valid node connection since there is no error from the\n\t\t// forwarded server, so add the mapping to cache the\n\t\t// connection and allow the server to send RPCs to the client.\n\t\tif err == nil && n.ctx != nil && n.ctx.NodeID == \"\" && !isForwarded {\n\t\t\tn.ctx.NodeID = args.NodeID\n\t\t\tn.srv.addNodeConn(n.ctx)\n\t\t}\n\n\t\treturn err\n\t}\n\tn.srv.MeasureRPCRate(\"node\", structs.RateMetricList, args)\n\tif authErr != nil {\n\t\treturn structs.ErrPermissionDenied\n\t}\n\tdefer metrics.MeasureSince([]string{\"nomad\", \"client\", \"get_client_allocs\"}, time.Now())\n\n\tif args.NodeID == \"\" {\n\t\treturn errors.New(\"missing node ID\")\n\t}\n\n\tnode, err := n.srv.State().NodeByID(nil, args.NodeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := auth.AuthorizeSameNode(args.GetIdentity(), args.NodeID); err != nil {\n\t\treturn err\n\t}\n\n\tif node != nil {\n\t\t// We have a valid node connection, so add the mapping to cache the\n\t\t// connection and allow the server to send RPCs to the client. We only\n\t\t// cache the connection if it is not being forwarded from another\n\t\t// server.\n\t\tif n.ctx != nil && n.ctx.NodeID == \"\" && !args.IsForwarded() {\n\t\t\tn.ctx.NodeID = args.NodeID","sourceCodeStart":1353,"sourceCodeEnd":1389,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/node_endpoint.go#L1353-L1389","documentation":"The GetClientAllocs RPC is used by Nomad clients to fetch their allocations, and requires the client to identify its node. The endpoint returns this error when the request's NodeID is an empty string, before doing any state lookup.","triggerScenarios":"A Nomad client contacting the server whose Node ID has not been generated/persisted yet, or a malformed/custom API call to v1/client/allocs (or the internal GetClientAllocs RPC) omitting NodeID.","commonSituations":"Corrupted or wiped client data dir losing node ID; custom tooling calling the internal RPC directly without setting NodeID; client registration timing issues.","solutions":["Ensure the Nomad client's data_dir is intact so its node ID persists; regenerate by restarting the client if lost.","If calling the API manually, supply the node ID (lookup via /v1/nodes) in the request.","Check client logs for node ID generation errors and fix underlying disk/permission issues."],"exampleFix":"// before\nreq := &structs.NodeClientAllocsRequest{}\n\n// after\nreq := &structs.NodeClientAllocsRequest{NodeID: node.ID}","handlingStrategy":"validation","validationCode":"if nodeID == \"\" {\n  return errors.New(\"GetClientAllocs requires a non-empty NodeID\")\n}","typeGuard":null,"tryCatchPattern":"if err := resp.Err(); err != nil && strings.Contains(err.Error(), \"missing node ID\") {\n  // re-fetch node ID from /v1/nodes and retry once\n  return retryWithResolvedNodeID()\n}","preventionTips":["Ensure client data_dir is persistent and writable so node ID survives restarts","Always populate NodeID in direct RPC/API calls","Monitor client logs for node identity errors"],"tags":["nomad","client","rpc","missing-parameter"],"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"}