hashicorp/nomad · error

invalid vault configuration: %v

Error message

invalid vault configuration: %v

What it means

Wrapper error from Namespace.Validate() for the multierror branch: when VaultConfiguration.Validate() returns a *multierror.Error, each sub-error is re-wrapped as 'invalid vault configuration: %v' and added to the namespace's validation result.

Source

Thrown at nomad/structs/structs.go:5681

		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:
		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()
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Read the inner message after the prefix for the actual failing field
  2. Fix the VaultConfiguration field (e.g. valid DefaultCluster name, matching regex)
  3. Validate the Vault configuration independently before submitting the namespace
  4. Verify Nomad/Vault integration docs for the version in use

Example fix

// before
ns.VaultConfiguration = &structs.VaultConfiguration{DefaultCluster: "vault/primary"} // invalid chars
// after
ns.VaultConfiguration = &structs.VaultConfiguration{DefaultCluster: "vault-primary"}
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: Namespace create/update where the namespace's Vault configuration block (default cluster/namespace or Vault task config defaults) fails validation, e.g. invalid cluster name format.

Common situations: Setting namespace.VaultConfiguration with an invalid DefaultCluster or empty required fields; Nomad Enterprise namespace-scoped Vault config mistakes; integrating Vault with Nomad for the first time.

Related errors


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