hashicorp/nomad · error
No node(s) with prefix or id %q found
Error message
No node(s) with prefix or id %q found
What it means
After a successful PrefixList, lookupNodeID checks whether any nodes matched. If the result set is empty, it throws "No node(s) with prefix or id %q found" — the query worked, but no node in the cluster has an ID matching the given prefix.
Source
Thrown at command/node.go:90
return formatKV(rows)
}
// lookupNodeID looks up a nodeID prefix and returns the full ID or an error.
// The error will always be suitable for displaying to users.
func lookupNodeID(client *api.Nodes, nodeID string) (string, error) {
if len(nodeID) == 1 {
return "", fmt.Errorf("Node ID must contain at least two characters.")
}
nodeID = sanitizeUUIDPrefix(nodeID)
nodes, _, err := client.PrefixList(nodeID)
if err != nil {
return "", fmt.Errorf("Error querying node: %w", err)
}
if len(nodes) == 0 {
return "", fmt.Errorf("No node(s) with prefix or id %q found", nodeID)
}
if len(nodes) > 1 {
return "", fmt.Errorf("Prefix matched multiple nodes\n\n%s",
formatNodeStubList(nodes, true))
}
return nodes[0].ID, nil
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Run `nomad node status` (no args) to list current node IDs.
- Verify you are querying the right cluster/region.
- Use `nomad server members` to check whether the client is registered.
- Correct the prefix or re-register the node.
Example fix
// before (shell) nomad node status deadbeef // node no longer exists // after nomad node status # list live nodes nomad node status <current-id>
Defensive patterns
Strategy: validation
Validate before calling
// shell: confirm node exists before deep status
nomad node status -json | jq -e --arg p "$ID" '.[] | select(.ID | startswith($p)) | .ID' >/dev/null \
|| { echo "no node matches $ID"; exit 1; } Try / catch
// bash: branch on message if ! out=$(nomad node status "$ID" 2>&1); then case "$out" in *"found"*) nomad node status ;; esac fi
Prevention
- List nodes (`nomad node status`) before referencing IDs in scripts.
- Track node lifecycle (deregistered/drained) in automation before issuing commands.
- Keep environment-specific ID caches fresh; don't reuse IDs across clusters.
When it happens
Trigger: Calling `nomad node status <prefix>` where PrefixList succeeds but returns zero nodes for the sanitized prefix.
Common situations: Node was drained/removed from the cluster; typo or prefix from a different cluster/environment; referencing a client node that never joined; stale node ID from old scripts or docs.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Namespace %q matched no namespaces
- Node ID must contain at least two characters.
- Error querying node: %w
- Prefix matched multiple nodes\n\n%s
- No node pool with prefix %q found
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/6753ce0363a7017b.
Report an issue: GitHub.