hashicorp/nomad · error

missing node pool name

Error message

missing node pool name

What it means

parseNodePoolLimit validates the `node_pool` block of a quota spec, where each entry's key is the node pool name. An entry with zero keys yields "missing node pool name", prefixed `resources, node pool[N]->`. Node pool quotas require a named entry per pool being limited.

Source

Thrown at command/quota_apply.go:417

		var m map[string]any
		if err := hcl.DecodeObject(&m, o.Val); err != nil {
			return err
		}

		if err := mapstructure.WeakDecode(m, &device); err != nil {
			return err
		}

		*result = append(*result, &device)
	}
	return nil
}

func parseNodePoolLimit(result *[]*api.NodePoolLimit, list *ast.ObjectList) error {
	for idx, o := range list.Items {
		if l := len(o.Keys); l == 0 {
			return multierror.Prefix(fmt.Errorf("missing node pool name"), fmt.Sprintf("resources, node pool[%d]->", idx))
		} else if l > 1 {
			return multierror.Prefix(fmt.Errorf("only one name may be specified"), fmt.Sprintf("resources, node pool[%d]->", idx))
		}

		name := o.Keys[0].Token.Value().(string)

		// Check for invalid keys
		valid := []string{
			"cores",
			"cpu",
			"memory",
			"memory_max",
			"device",
			"storage",
		}
		if err := helper.CheckHCLKeys(o.Val, valid); err != nil {
			return err
		}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Add the pool name as the block key: `node_pool "prod" { memory_mb = 8192 }`.
  2. Use the `node pool[N]` index in the error to locate the entry.
  3. Ensure you run a Nomad client version that supports node pool quotas (>=1.4).
  4. Cross-check the stanza against official quota examples.

Example fix

// before
node_pool {
  memory_mb = 8192
}
// after
node_pool "prod" {
  memory_mb = 8192
}
Defensive patterns

Strategy: validation

Validate before calling

for idx, item := range nodePoolList.Items {
    if len(item.Keys) == 0 {
        return fmt.Errorf("resources, node pool[%d]-> missing node pool name", idx)
    }
}

Type guard

func nodePoolHasName(item *hclast.ObjectItem) bool {
    return item != nil && len(item.Keys) == 1
}

Prevention

When it happens

Trigger: A quota file contains an anonymous `node_pool { ... }` block (no name key) inside resources, e.g. from copy-pasting job node_pool syntax or hand-editing that removed the quoted pool name.

Common situations: Template files with a placeholder pool name deleted; HCL generation code emitting unlabeled blocks; migrating between Nomad versions where syntax examples differ (node pool quotas were added in Nomad 1.4+).

Related errors


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