OpenNHP/opennhp · error

: [[Servers]][ ] and [[Servers]][ ] share Name

Error message

%s: [[Servers]][%d] and [[Servers]][%d] share Name %q

What it means

Cluster-config validation error from Normalize's duplicate-name pass (only when opts.RequireName): two [[Servers]] entries use the same Name. Since resource.toml references clusters by Name, a duplicate would make the reference ambiguous, so the second occurrence is rejected with both indexes and the shared name.

Solutions

  1. Rename one of the clusters to a unique Name
  2. Update any resource.toml references that pointed at the renamed cluster
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nhp/common/clusterconfig/clusterconfig.go:231 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of OpenNHP/opennhp@6e04ca5ff0 (2026-09-07). Data as JSON: /api/errors/b4d69b4f78ae7416. Report an issue: GitHub.

Appendix: source

Thrown at nhp/common/clusterconfig/clusterconfig.go:231

	// "wrong instance answered" at runtime.
	seenPK := make(map[string]int, len(clusters))
	for i, c := range clusters {
		if prev, ok := seenPK[c.PubKeyBase64]; ok {
			return fmt.Errorf("%s: [[Servers]][%d] and [[Servers]][%d] share PubKeyBase64 %s — "+
				"merge them into one cluster with multiple Instances",
				label, prev, i, c.PubKeyBase64)
		}
		seenPK[c.PubKeyBase64] = i
	}

	// Duplicate Name detection — only meaningful when names are
	// required (and therefore non-empty). For consumers that leave Name
	// optional, blank names are allowed to repeat.
	if opts.RequireName {
		seenName := make(map[string]int, len(clusters))
		for i, c := range clusters {
			if prev, ok := seenName[c.Name]; ok {
				return fmt.Errorf("%s: [[Servers]][%d] and [[Servers]][%d] share Name %q",
					label, prev, i, c.Name)
			}
			seenName[c.Name] = i
		}
	}
	return nil
}

View on GitHub (pinned to 6e04ca5ff0)