hashicorp/nomad · error

invalid node pool configuration: %v

Error message

invalid node pool configuration: %v

What it means

Wrapper error emitted by Namespace.Validate() when NodePoolConfiguration.Validate() returns a *multierror.Error: each underlying validation failure is re-wrapped as 'invalid node pool configuration: %v' and appended to the namespace's multierror. The real cause is in the inner npErr text.

Source

Thrown at nomad/structs/structs.go:5671

func (n *Namespace) Validate() error {
	var mErr multierror.Error

	// Validate the name and description
	if !validNamespaceName.MatchString(n.Name) {
		err := fmt.Errorf("invalid name %q. Must match regex %s", n.Name, validNamespaceName)
		mErr.Errors = append(mErr.Errors, err)
	}
	if len(n.Description) > maxNamespaceDescriptionLength {
		err := fmt.Errorf("description longer than %d", maxNamespaceDescriptionLength)
		mErr.Errors = append(mErr.Errors, err)
	}

	err := n.NodePoolConfiguration.Validate()
	switch e := err.(type) {
	case *multierror.Error:
		for _, npErr := range e.Errors {
			mErr.Errors = append(mErr.Errors, fmt.Errorf("invalid node pool configuration: %v", npErr))
		}
	case error:
		mErr.Errors = append(mErr.Errors, fmt.Errorf("invalid node pool configuration: %v", e))
	}

	err = n.VaultConfiguration.Validate()
	switch e := err.(type) {
	case *multierror.Error:
		for _, vErr := range e.Errors {
			mErr.Errors = append(mErr.Errors, fmt.Errorf("invalid vault configuration: %v", vErr))
		}
	case error:
		mErr.Errors = append(mErr.Errors, fmt.Errorf("invalid vault configuration: %v", e))
	}

	err = n.ConsulConfiguration.Validate()
	switch e := err.(type) {
	case *multierror.Error:

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Read the inner '%v' text after the prefix — it names the actual failing field
  2. Fix the offending NodePoolConfiguration field per the inner message
  3. Validate the node pool config standalone (NodePoolConfiguration.Validate()) before submitting
  4. Check Nomad version: node pool names must also satisfy the node pool name regex

Example fix

// before
ns.NodePoolConfiguration = &structs.NodePoolConfiguration{Cluster: ""} // missing required field
// after
ns.NodePoolConfiguration = &structs.NodePoolConfiguration{Cluster: "default"}
Defensive patterns

Strategy: validation

Validate before calling

if err := ns.NodePoolConfiguration.Validate(); err != nil {
    return fmt.Errorf("namespace node pool config invalid: %w", err)
}

Prevention

When it happens

Trigger: Creating/updating a namespace whose NodePoolConfiguration (e.g. scheduler configuration or node pool settings) fails its own Validate, via `nomad namespace apply` or the namespace API.

Common situations: Invalid SchedulerConfiguration values inside a namespace's node pool config; malformed HCL/JSON when defining namespace node pool settings; API version mismatch producing unknown fields.

Related errors


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