OpenNHP/opennhp · error

: [[Servers]][ ] Name exceeds chars

Error message

%s: [[Servers]][%d] Name %q exceeds %d chars

What it means

Cluster-config validation error raised inside Normalize when opts.RequireName is set and a [[Servers]] entry's Name exceeds NameMaxLen characters. Cluster names are the reference key used by resource.toml entries, and they also feed fixed-size protocol/log fields, so over-long names are rejected at load time with the offending index and value included.

Solutions

  1. Shorten the Name in the [[Servers]] entry to the documented maximum
  2. Choose a short cluster alias and keep long descriptions in comments or other fields
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nhp/common/clusterconfig/clusterconfig.go:155 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/28dd64c475d38094. Report an issue: GitHub.

Appendix: source

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

	}

	if len(clusters) == 0 {
		return fmt.Errorf("%s: no [[Servers]] configured", label)
	}
	for i, c := range clusters {
		if c == nil {
			return fmt.Errorf("%s: [[Servers]][%d] is nil", label, i)
		}
		if c.PubKeyBase64 == "" {
			return fmt.Errorf("%s: [[Servers]][%d] missing PubKeyBase64", label, i)
		}
		if opts.RequireName {
			if c.Name == "" {
				return fmt.Errorf("%s: [[Servers]][%d] (%s) missing Name — clusters are referenced from resource.toml by Name",
					label, i, c.PubKeyBase64)
			}
			if len(c.Name) > NameMaxLen {
				return fmt.Errorf("%s: [[Servers]][%d] Name %q exceeds %d chars",
					label, i, c.Name, NameMaxLen)
			}
			if !clusterNameRegex.MatchString(c.Name) {
				return fmt.Errorf("%s: [[Servers]][%d] Name %q invalid — allowed chars: [a-zA-Z0-9._-]",
					label, i, c.Name)
			}
		}

		legacy := c.hasLegacyFields()
		hasInstances := len(c.Instances) > 0

		switch {
		case legacy && hasInstances:
			// Both forms in one entry is almost certainly an
			// incomplete migration. Refuse to guess which one the
			// operator meant.
			return fmt.Errorf("%s: [[Servers]][%d] (%s) sets both top-level Ip/Hostname/Port and [[Servers.Instances]]; "+
				"pick one form — top-level fields are deprecated, prefer Instances",

View on GitHub (pinned to 6e04ca5ff0)