hashicorp/nomad · error
node ids missing
Error message
node ids missing
What it means
deleteNodeTxn rejects a request to delete nodes when the supplied node ID slice is empty. It is an internal guard so a no-op batch delete never commits an index bump or emits node deregistration events. It surfaces to callers of StateStore.DeleteNode as a generic error.
Source
Thrown at nomad/state/state_store.go:1071
return nil
}
// DeleteNode deregisters a batch of nodes
func (s *StateStore) DeleteNode(msgType structs.MessageType, index uint64, nodes []string) error {
txn := s.db.WriteTxn(index)
defer txn.Abort()
err := s.deleteNodeTxn(txn, index, nodes)
if err != nil {
return nil
}
return txn.Commit()
}
func (s *StateStore) deleteNodeTxn(txn *txn, index uint64, nodes []string) error {
if len(nodes) == 0 {
return fmt.Errorf("node ids missing")
}
for _, nodeID := range nodes {
existing, err := txn.First("nodes", "id", nodeID)
if err != nil {
return fmt.Errorf("node lookup failed: %s: %v", nodeID, err)
}
if existing == nil {
return fmt.Errorf("node not found: %s", nodeID)
}
// Delete the node
if err := txn.Delete("nodes", existing); err != nil {
return fmt.Errorf("node delete failed: %s: %v", nodeID, err)
}
node := existing.(*structs.Node)
if err := deleteNodeCSIPlugins(txn, node, index); err != nil {View on GitHub (pinned to 482b49bf1a)
Solutions
- Return early with a success/no-op if len(nodeIDs) == 0 before calling DeleteNode.
- Reject the request in the HTTP/RPC handler with a 400/invalid-params error before touching the state store.
- Inspect where the ID list is built and fix the upstream filtering that dropped all IDs.
Example fix
// before
if err := store.DeleteNode(1000, nodeIDs); err != nil { ... }
// after
if len(nodeIDs) == 0 {
return nil // or return a 400 invalid-params error
}
if err := store.DeleteNode(1000, nodeIDs); err != nil { ... } Defensive patterns
Strategy: validation
Validate before calling
if len(nodeIDs) == 0 {
return fmt.Errorf("at least one node id is required")
} Try / catch
if err := store.DeleteNode(idx, nodeIDs); err != nil {
if err.Error() == "node ids missing" {
return fmt.Errorf("no node ids supplied")
}
return err
} Prevention
- Validate request payloads at the RPC/HTTP layer before touching the state store.
- Check that ID-list construction (filters, dedup) never silently empties the list.
- Return explicit empty-parameter errors to API clients with 400 status.
When it happens
Trigger: Calling StateStore.DeleteNode (indirectly via deleteNodeTxn) with a zero-length nodes slice, typically because the caller built the list from an empty request payload.
Common situations: An HTTP Node.Deregister (batch) request with an empty node_ids array; a derived list of node IDs filtered down to nothing before calling DeleteNode.
Related errors
- node not found: %s
- acl token lookup failed: missing accessor id
- acl token lookup failed: missing secret id
- error parsing: root should be an object
- cannot specify Accessor ID
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/a376d5b00e9acfcc.
Report an issue: GitHub.