hashicorp/nomad · error

missing node pool name

Error message

missing node pool name

What it means

Guard in NodePools.Info: the node pool name used to build the /v1/node/pool/<name> query was an empty string; the caller must supply a concrete pool name.

Source

Thrown at api/node_pools.go:54

	if err != nil {
		return nil, nil, err
	}
	return resp, qm, nil
}

// PrefixList is used to list node pools that match a given prefix.
func (n *NodePools) PrefixList(prefix string, q *QueryOptions) ([]*NodePool, *QueryMeta, error) {
	if q == nil {
		q = &QueryOptions{}
	}
	q.Prefix = prefix
	return n.List(q)
}

// Info is used to fetch details of a specific node pool.
func (n *NodePools) Info(name string, q *QueryOptions) (*NodePool, *QueryMeta, error) {
	if name == "" {
		return nil, nil, errors.New("missing node pool name")
	}

	var resp NodePool
	qm, err := n.client.query("/v1/node/pool/"+url.PathEscape(name), &resp, q)
	if err != nil {
		return nil, nil, err
	}
	return &resp, qm, nil
}

// Register is used to create or update a node pool.
func (n *NodePools) Register(pool *NodePool, w *WriteOptions) (*WriteMeta, error) {
	if pool == nil {
		return nil, errors.New("missing node pool")
	}
	if pool.Name == "" {
		return nil, errors.New("missing node pool name")
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Pass a non-empty pool name; default to "default" when the name is empty
  2. Validate the name argument before calling Info
  3. Check where the name is sourced (flag/config/node field) and ensure it is populated

Example fix

// before
pool, _, err := np.Info(name, nil)
// after
if name == "" {
    name = "default"
}
pool, _, err := np.Info(name, nil)
Defensive patterns

Strategy: validation

Validate before calling

func poolNameOK(name string) bool { return name != "" }

Try / catch

pool, _, err := nodePools.Info(name, nil)
if err != nil && strings.Contains(err.Error(), "missing node pool name") {
    return fmt.Errorf("node pool name required (got empty)")
}

Prevention

When it happens

Trigger: Calling n.Info("", q) with a name sourced from an empty flag, unset config value, or empty node's NodePool field (older nodes without pool assignment).

Common situations: CLI flag --node-pool not provided; reading NodePool off a pre-0.17 node struct where it defaults to empty; config interpolation resolving to an empty string.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/5726fe7e8105af81. Report an issue: GitHub.