{"record":{"id":"7fa865e0631135b5","repo":"hashicorp/nomad","slug":"failed-to-computed-node-class-v","errorCode":null,"errorMessage":"failed to computed node class: %v","messagePattern":"failed to computed node class: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/node_endpoint.go","lineNumber":162,"sourceCode":"\t\targs.Node.SchedulingEligibility = structs.NodeSchedulingEligible\n\t}\n\n\t// Default the node pool if none is given.\n\tif args.Node.NodePool == \"\" {\n\t\targs.Node.NodePool = structs.NodePoolDefault\n\t}\n\n\t// The current time is used at a number of places in the registration\n\t// workflow. Generating it once avoids multiple calls to time.Now() and also\n\t// means the same time is used across all checks and sets.\n\ttimeNow := time.Now()\n\n\t// Set the timestamp when the node is registered\n\targs.Node.StatusUpdatedAt = timeNow.Unix()\n\n\t// Compute the node class\n\tif err := args.Node.ComputeClass(); err != nil {\n\t\treturn fmt.Errorf(\"failed to computed node class: %v\", err)\n\t}\n\n\t// Look for the node so we can detect a state transition\n\tsnap, err := n.srv.fsm.State().Snapshot()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tws := memdb.NewWatchSet()\n\toriginalNode, err := snap.NodeByID(ws, args.Node.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If the node has an entry in the state store, we perform a check to ensure\n\t// the secret ID matches the one stored. If there is no entry, we perform a\n\t// check to ensure the node is allowed to register given the request and the\n\t// server introduction enforcement configuration.","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/node_endpoint.go#L144-L180","documentation":"During Node.Register the server computes the node's computed node class (derived constraints/affinities from node attributes and drivers) via Node.ComputeClass. If that internal computation fails, registration is aborted with 'failed to computed node class: %v' wrapping the underlying cause. The node is not registered.","triggerScenarios":"Registering a node whose attributes/meta cause ComputeClass to fail — e.g. malformed meta values or attribute data the evaluation logic cannot process; a corrupt or hand-crafted node payload.","commonSituations":"Custom clients sending malformed Node fields; Nomad version mismatches where the server cannot evaluate client-provided data; agent misconfiguration producing unparseable attributes/meta.","solutions":["Read the wrapped %v cause in the server error/log for the real failure.","Fix the node's attributes/meta on the client (client.meta, plugin settings) so ComputeClass can evaluate them.","Align client and server Nomad versions and restart the agent to resend a clean node payload.","If it persists on an up-to-date agent, file a Nomad issue with the wrapped error — ComputeClass should not fail on well-formed input."],"exampleFix":"// before (client config with problematic meta)\nclient { meta { tags = \"${bad-expression\" } }\n// after\nclient { meta { tags = \"prod,web\" } }","handlingStrategy":"try-catch","validationCode":"// ensure node fields sent by custom clients are well-formed before registering\nif n.Attributes == nil || n.Datacenter == \"\" || n.Name == \"\" {\n    return fmt.Errorf(\"node payload incomplete; refusing to register\")\n}","typeGuard":null,"tryCatchPattern":"_, err := client.Nodes().Register(node, nil)\nif err != nil && strings.Contains(err.Error(), \"failed to computed node class\") {\n    // inspect wrapped cause in server logs; fix node meta/attributes and re-register\n}","preventionTips":["Read the wrapped cause, not just the wrapper message.","Keep client and server Nomad versions aligned.","Avoid hand-crafted or edited node payloads.","Fix invalid client.meta/attribute values on the agent config before re-registering."],"tags":["nomad","node-registration","computed-class"],"backgroundTag":"node-registration-failed","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"}