{"record":{"id":"67032ef00d42700a","repo":"hashicorp/nomad","slug":"missing-attributes-for-client-registration","errorCode":null,"errorMessage":"missing attributes for client registration","messagePattern":"missing attributes for client registration","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/node.go","lineNumber":612,"sourceCode":"\n// Validate checks that the NodeRegisterRequest is valid. Any returned error can\n// be sent back to the client as a response to the RPC call.\nfunc (n *NodeRegisterRequest) Validate() error {\n\n\tif n.Node == nil {\n\t\treturn errors.New(\"missing node for client registration\")\n\t}\n\tif n.Node.ID == \"\" {\n\t\treturn errors.New(\"missing node ID for client registration\")\n\t}\n\tif n.Node.Datacenter == \"\" {\n\t\treturn errors.New(\"missing datacenter for client registration\")\n\t}\n\tif n.Node.Name == \"\" {\n\t\treturn errors.New(\"missing node name for client registration\")\n\t}\n\tif len(n.Node.Attributes) == 0 {\n\t\treturn errors.New(\"missing attributes for client registration\")\n\t}\n\tif n.Node.SecretID == \"\" {\n\t\treturn errors.New(\"missing node secret ID for client registration\")\n\t}\n\tif n.Node.NodePool != \"\" {\n\t\tif err := ValidateNodePoolName(n.Node.NodePool); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid node pool: %v\", err)\n\t\t}\n\t\tif n.Node.NodePool == NodePoolAll {\n\t\t\treturn fmt.Errorf(\"node is not allowed to register in node pool %q\", NodePoolAll)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// ShouldGenerateNodeIdentity compliments the functionality within\n// AuthenticateNodeIdentityGenerator to determine whether a new node identity","sourceCodeStart":594,"sourceCodeEnd":630,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/node.go#L594-L630","documentation":"NodeRegisterRequest.Validate returns this error when the Node's Attributes map is empty. Attributes carry fingerprinted driver and environment information (os, arch, drivers, etc.); a node registering with no attributes looks fingerprint-less and cannot be scheduled against, so registration is rejected.","triggerScenarios":"Calling Node.Register with len(Node.Attributes) == 0, e.g. hand-built requests that skip fingerprint results, or clients whose fingerprints produced nothing and that code path didn't guard.","commonSituations":"Test fixtures and mocks registering bare-bones nodes without attribute maps; custom forks or plugins that bypass the fingerprinter; clients running in restricted environments where all fingerprints were disabled but the map was never seeded.","solutions":["Populate Node.Attributes with at least the base fingerprints (e.g. os.name, arch) before registering — normally produced automatically by the client fingerprinter.","In tests/fixtures, add a minimal attribute map to the Node struct.","If fingerprints legitimately fail, enable the client's fingerprinting (or add static attributes via `client.meta`/fingerprint config) and re-register."],"exampleFix":"// before\nnode := &structs.Node{ID: id, Datacenter: \"dc1\", Name: name}\n// after\nnode := &structs.Node{ID: id, Datacenter: \"dc1\", Name: name,\n\tAttributes: map[string]string{\"os.name\": \"linux\", \"arch\": \"amd64\"}}","handlingStrategy":"validation","validationCode":"if len(node.Attributes) == 0 {\n\treturn errors.New(\"node has no fingerprinted attributes; check client fingerprinting\")\n}","typeGuard":null,"tryCatchPattern":"if err := req.Validate(); err != nil {\n\tif strings.Contains(err.Error(), \"missing attributes\") {\n\t\treturn fmt.Errorf(\"client fingerprinting produced no attributes: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Let the built-in fingerprinter run; don't bypass it in custom clients.","Seed test fixture nodes with a minimal attribute map.","Keep base fingerprints enabled in restricted environments."],"tags":["nomad","rpc","validation","fingerprint"],"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"}