{"record":{"id":"0da311fd8e92f30c","repo":"hashicorp/nomad","slug":"node-id-q-is-not-in-pool-q","errorCode":null,"errorMessage":"node ID %q is not in pool %q","messagePattern":"node ID %q is not in pool %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/host_volume_endpoint.go","lineNumber":471,"sourceCode":"\t\tif err != nil {\n\t\t\treturn err // should never hit, bail out\n\t\t}\n\t\tif node == nil {\n\t\t\treturn fmt.Errorf(\"node %q does not exist\", vol.NodeID)\n\t\t}\n\t\tpoolFromExistingNode = node.NodePool\n\t}\n\n\tif vol.NodePool != \"\" {\n\t\tpool, err := snap.NodePoolByName(nil, vol.NodePool)\n\t\tif err != nil {\n\t\t\treturn err // should never hit, bail out\n\t\t}\n\t\tif pool == nil {\n\t\t\treturn fmt.Errorf(\"node pool %q does not exist\", vol.NodePool)\n\t\t}\n\t\tif poolFromExistingNode != \"\" && poolFromExistingNode != pool.Name {\n\t\t\treturn fmt.Errorf(\"node ID %q is not in pool %q\", vol.NodeID, vol.NodePool)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (v *HostVolume) createVolume(vol *structs.HostVolume) error {\n\n\tmethod := \"ClientHostVolume.Create\"\n\tcReq := &cstructs.ClientHostVolumeCreateRequest{\n\t\tID:                        vol.ID,\n\t\tName:                      vol.Name,\n\t\tPluginID:                  vol.PluginID,\n\t\tNamespace:                 vol.Namespace,\n\t\tNodeID:                    vol.NodeID,\n\t\tRequestedCapacityMinBytes: vol.RequestedCapacityMinBytes,\n\t\tRequestedCapacityMaxBytes: vol.RequestedCapacityMaxBytes,\n\t\tParameters:                vol.Parameters,","sourceCodeStart":453,"sourceCodeEnd":489,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/host_volume_endpoint.go#L453-L489","documentation":"During host volume Create/Register, validateVolumeForState checks that the volume's explicit node pool actually contains the volume's explicit node ID. Nomad looks up the node's real pool and compares it with vol.NodePool; a mismatch means the request pins a node and a pool that disagree, which would corrupt pool governance. The server rejects the write rather than silently reassigning the pool.","triggerScenarios":"Calling `nomad host volume create` (or register) with both NodeID and NodePool set, where the specified node belongs to a different node pool than the one supplied (e.g. node in 'prod' pool but request says NodePool='dev').","commonSituations":"Copy-pasting a job/volume spec and editing only the node pool field; automation that sets NodePool from stale inventory while NodeID comes from a scheduler or operator; a node recently moved to another pool while cached specs still reference the old pool.","solutions":["Set NodePool to the actual pool of the given node (query `nomad node status <id>` for its Node Pool), or omit NodePool entirely and let the server derive it from the node.","If the pool is what you intended, omit NodeID and let placeHostVolume pick a node from that pool.","Verify the node hasn't been moved to a different pool; update your automation/config to the node's current pool."],"exampleFix":"// before\nhv := &api.HostVolume{ NodeID: nodeId, NodePool: \"dev\" }\n// after\nnode, _ := client.Nodes().Info(nodeId, nil)\nhv := &api.HostVolume{ NodeID: nodeId, NodePool: node.NodePool } // or leave NodePool empty","handlingStrategy":"validation","validationCode":"node, _, err := client.Nodes().Info(vol.NodeID, nil)\nif err != nil { return err }\nif vol.NodePool != \"\" && node.NodePool != vol.NodePool {\n    return fmt.Errorf(\"node %s is in pool %q, not %q\", vol.NodeID, node.NodePool, vol.NodePool)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never set both NodeID and NodePool; let the server derive the pool from the node.","Fetch the node's current pool from the API instead of hardcoding it in specs.","Re-validate templates after nodes move between pools."],"tags":["nomad","host-volumes","node-pool","validation"],"backgroundTag":"node-pool-mismatch","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"}