nats-io/nats-server · error

invalid leafnode's minimum version: %v

Error message

invalid leafnode's minimum version: %v

What it means

checkLeafMinVersionConfig validates the leafnode minimum version setting and wraps a parse failure from versionAtLeastCheckError as "invalid leafnode's minimum version: %v". It throws when the configured minimum version string cannot be parsed as a semver version. Called from validateLeafNode and parseLeafNodes when leafnodes.min_version is set.

Source

Thrown at server/leafnode.go:360

	if o.Gateway.Name == _EMPTY_ && o.Gateway.Port == 0 {
		return nil
	}
	// If we are here we have both leaf nodes and gateways defined, make sure there
	// is a system account defined.
	if o.SystemAccount == _EMPTY_ {
		return fmt.Errorf("leaf nodes and gateways (both being defined) require a system account to also be configured")
	}
	if err := validatePinnedCerts(o.LeafNode.TLSPinnedCerts); err != nil {
		return fmt.Errorf("leafnode: %v", err)
	}
	return nil
}

func checkLeafMinVersionConfig(mv string) error {
	if ok, err := versionAtLeastCheckError(mv, 2, 8, 0); !ok || err != nil {
		if err != nil {
			return fmt.Errorf("invalid leafnode's minimum version: %v", err)
		} else {
			return fmt.Errorf("the minimum version should be at least 2.8.0")
		}
	}
	return nil
}

// Used to validate user names in LeafNode configuration.
// - rejects mix of single and multiple users.
// - rejects duplicate user names.
func validateLeafNodeAuthOptions(o *Options) error {
	if len(o.LeafNode.Users) == 0 {
		return nil
	}
	if o.LeafNode.Username != _EMPTY_ {
		return fmt.Errorf("can not have a single user/pass and a users array")
	}
	if o.LeafNode.Nkey != _EMPTY_ {

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Set min_version to a valid semantic version string, e.g. "2.8.0"
  2. Check the wrapped %v error to see the exact parse problem
  3. Remove the min_version setting if the constraint is not needed

Example fix

// before
leafnodes { min_version: "2.8" }
// after
leafnodes { min_version: "2.8.0" }
Defensive patterns

Strategy: validation

Validate before calling

if mv := cfg.LeafNodes.MinVersion; mv != "" {
  if _, err := semver.NewVersion(mv); err != nil {
    return fmt.Errorf("invalid leafnode min_version %q: %v", mv, err)
  }
}

Prevention

When it happens

Trigger: Config contains leafnodes { min_version: "<unparseable string>" } and the server validates options or parses leaf node config; versionAtLeastCheckError returns a non-nil error (bad version format).

Common situations: Typos like "v.2.8.0", "2.8", "latest", or pasting a full version string with build metadata that the parser rejects.

Related errors


AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02). Data as JSON: /api/errors/91a600dc0ddcad2a. Report an issue: GitHub.