hashicorp/nomad · error

invalid consul configuration: %v

Error message

invalid consul configuration: %v

What it means

Wrapper error from Namespace.Validate() for the multierror branch of ConsulConfiguration.Validate(): each sub-error is re-wrapped as 'invalid consul configuration: %v' and appended to the namespace's multierror.

Source

Thrown at nomad/structs/structs.go:5691

	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:
		for _, cErr := range e.Errors {
			mErr.Errors = append(mErr.Errors, fmt.Errorf("invalid consul configuration: %v", cErr))
		}
	case error:
		mErr.Errors = append(mErr.Errors, fmt.Errorf("invalid consul configuration: %v", e))
	}

	return mErr.ErrorOrNil()
}

// SetHash is used to compute and set the hash of the namespace
func (n *Namespace) SetHash() []byte {
	// Initialize a 256bit Blake2 hash (32 bytes)
	hash, err := blake2b.New256(nil)
	if err != nil {
		panic(err)
	}

	// Write all the user set fields
	_, _ = hash.Write([]byte(n.Name))

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Read the inner message after the prefix to find the failing field
  2. Fix the ConsulConfiguration value (e.g. valid DefaultCluster matching the allowed regex)
  3. Validate the Consul configuration standalone before submitting
  4. Confirm the field is supported in your Nomad version

Example fix

// before
ns.ConsulConfiguration = &structs.ConsulConfiguration{DefaultCluster: "consul.prod!"}
// after
ns.ConsulConfiguration = &structs.ConsulConfiguration{DefaultCluster: "default"}
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: Namespace create/update where the namespace's Consul configuration (e.g. DefaultCluster) fails validation, via `nomad namespace apply` or the namespace HTTP API.

Common situations: Invalid Consul cluster name in a namespace (Nomad 1.7+ consul namespace support); wrong field name in JSON/HCL; enabling Consul config on OSS where fields are ignored/rejected.

Related errors


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