{"record":{"id":"8c997f57fcda65c7","repo":"hashicorp/nomad","slug":"w-s-8c997f","errorCode":null,"errorMessage":"%w %s","messagePattern":"%w %s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/util.go","lineNumber":88,"sourceCode":"\tfor i := 1; i < l; i++ {\n\t\tcur := inputs[i]\n\t\tif cur > max {\n\t\t\tmax = cur\n\t\t}\n\t}\n\treturn max\n}\n\n// getNodeForRpc returns a Node struct if the Node supports Node RPC. Otherwise\n// an error is returned.\nfunc getNodeForRpc(snap *state.StateSnapshot, nodeID string) (*structs.Node, error) {\n\tnode, err := snap.NodeByID(nil, nodeID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif node == nil {\n\t\treturn nil, fmt.Errorf(\"%w %s\", structs.ErrUnknownNode, nodeID)\n\t}\n\n\tif err := nodeSupportsRpc(node); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn node, nil\n}\n\nvar minNodeVersionSupportingRPC = version.Must(version.NewVersion(\"0.8.0-rc1\"))\n\n// nodeSupportsRpc returns a non-nil error if a Node does not support RPC.\nfunc nodeSupportsRpc(node *structs.Node) error {\n\trawNodeVer, ok := node.Attributes[\"nomad.version\"]\n\tif !ok {\n\t\treturn structs.ErrUnknownNomadVersion\n\t}\n","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/util.go#L70-L106","documentation":"getNodeForRpc resolves the target node ID from the state store before node-scoped RPCs (GC, restart, signal, pause state). If no node with that ID exists, it returns structs.ErrUnknownNode wrapped with the node ID. The error tells the caller the node ID does not match any registered node.","triggerScenarios":"Any node RPC (ClientAllocations.Restart/Signal, System.GarbageCollect node-scoped, pause state calls) with a NodeID that is absent from the state store — node deregistered, wrong ID, or wrong region.","commonSituations":"Targeting a node that was garbage-collected after being down past the deregister interval; copy/paste of a node ID from another cluster or region; using an alloc ID instead of a node ID by mistake.","solutions":["Run `nomad node status` and use an exact NodeID from that output","Check you are targeting the correct region/cluster (-region flag)","If the node was deregistered, restart the Nomad agent on it so it re-registers","Confirm the node ID passed is the node's ID, not an allocation ID"],"exampleFix":"// before\nclient.Nodes().Restart(\"a1b2c3\") // alloc-style or stale ID\n\n// after\nnodes, _ := client.Nodes().List(nil)\nnodeID := nodes[0].ID // exact ID from the API\nclient.Nodes().Restart(nodeID)","handlingStrategy":"validation","validationCode":"nodes, _, err := client.Nodes().List(nil)\nif err != nil { return err }\nvalid := false\nfor _, n := range nodes {\n    if n.ID == nodeID { valid = true; break }\n}\nif !valid { return fmt.Errorf(\"node %q is not registered in this cluster/region\", nodeID) }","typeGuard":"func nodeExists(nodes []*api.NodeListStub, id string) bool {\n    for _, n := range nodes { if n.ID == id { return true } }\n    return false\n}","tryCatchPattern":"_, err := client.Nodes().Restart(nodeID, nil)\nvar nr *api.Node\nclassifier := func(err error) bool { return strings.Contains(err.Error(), structs.ErrUnknownNode.Error()) }\nif classifier(err) { /* refresh node list, re-register node, or fix ID/region */ }","preventionTips":["Always source node IDs from `nomad node status` or the node list API","Pass the correct -region when targeting multi-region clusters","Distinguish node IDs from allocation IDs","Re-register nodes that fell out of the state store"],"tags":["nomad","nodes","not-found","rpc"],"backgroundTag":"unknown-node","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"}