nats-io/nats-server · error

found duplicate account name %q in pinned accounts list %q

Error message

found duplicate account name %q in pinned accounts list %q

What it means

validateCluster found the same account name twice in cluster.pinned_accounts while building a de-duplication map. Duplicate pinned account entries are rejected because the pinned set must be unique for pool pre-allocation.

Source

Thrown at server/server.go:1147

		}
		// Set this here so we do not consider it dynamic.
		o.Cluster.Name = o.Gateway.Name
	}
	clusterName := o.Cluster.Name
	if clusterName == _EMPTY_ && len(o.LeafNode.Remotes) > 0 && o.Cluster.Port == 0 {
		clusterName = o.ServerName
	}
	if clusterName == leafNoOriginCluster {
		return ErrClusterNameReserved
	}
	if l := len(o.Cluster.PinnedAccounts); l > 0 {
		if o.Cluster.PoolSize < 0 {
			return fmt.Errorf("pool_size cannot be negative if pinned accounts are specified")
		}
		m := make(map[string]struct{}, l)
		for _, a := range o.Cluster.PinnedAccounts {
			if _, exists := m[a]; exists {
				return fmt.Errorf("found duplicate account name %q in pinned accounts list %q", a, o.Cluster.PinnedAccounts)
			}
			m[a] = struct{}{}
		}
	}
	return nil
}

func validatePinnedCerts(pinned PinnedCertSet) error {
	re := regexp.MustCompile("^[a-f0-9]{64}$")
	for certId := range pinned {
		entry := strings.ToLower(certId)
		if !re.MatchString(entry) {
			return fmt.Errorf("error parsing 'pinned_certs' key %s does not look like lower case hex-encoded sha256 of DER encoded SubjectPublicKeyInfo", entry)
		}
	}
	return nil
}

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Remove the duplicate account name from pinned_accounts
  2. Check for copy-paste duplicates across config includes/templates
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/server.go:1147 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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