hashicorp/nomad · error

invalid name %q, must match regex %s

Error message

invalid name %q, must match regex %s

What it means

ValidateNodePoolName rejected the name because it does not match ^[a-zA-Z0-9-_]{1,128}$; node pool names are restricted to letters, digits, hyphens and underscores with length 1-128.

Source

Thrown at nomad/structs/node_pool.go:47

	// maxNodePoolDescriptionLength is the maximum length allowed for a node
	// pool description.
	maxNodePoolDescriptionLength = 256

	// DefaultNodePoolNodeIdentityTTL is the default TTL for node identities
	// when the operator does not specify this as part of the node pool
	// specification.
	DefaultNodePoolNodeIdentityTTL = 24 * time.Hour
)

var (
	// validNodePoolName is the rule used to validate a node pool name.
	validNodePoolName = regexp.MustCompile("^[a-zA-Z0-9-_]{1,128}$")
)

// ValidateNodePoolName returns an error if a node pool name is invalid.
func ValidateNodePoolName(pool string) error {
	if !validNodePoolName.MatchString(pool) {
		return fmt.Errorf("invalid name %q, must match regex %s", pool, validNodePoolName)
	}
	return nil
}

// NodePool allows partitioning infrastructure
type NodePool struct {
	// Name is the node pool name. It must be unique.
	Name string

	// Description is the human-friendly description of the node pool.
	Description string

	// Meta is a set of user-provided metadata for the node pool.
	Meta map[string]string

	// SchedulerConfiguration is the scheduler configuration specific to the
	// node pool.
	SchedulerConfiguration *NodePoolSchedulerConfiguration

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Rename the pool using only [a-zA-Z0-9-_]
  2. Shorten the name to at most 128 characters
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nomad/structs/node_pool.go:47 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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