OpenNHP/opennhp · error

: [[Servers]][ ] ( )

Error message

%s: [[Servers]][%d] (%s): %w

What it means

Wrapper error from Normalize: it forwards (with %w) the failure returned by c.LoadBalance.Validate() for the named server entry, prefixing it with the config location (label, index, pubkey) so the underlying scheme error is attributable to the right [[Servers]] entry.

Solutions

  1. Read the wrapped message to see the invalid loadBalance value and the list of valid schemes
  2. Set loadBalance to an accepted scheme name or leave it empty to get the default
  3. Correct the value in the server.toml entry identified by index/pubkey
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nhp/common/clusterconfig/clusterconfig.go:192 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/02a9ea9b1a5c7af1. Report an issue: GitHub.

Appendix: source

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

				label, i, c.PubKeyBase64)
		case legacy && !hasInstances:
			deprecate("%s: [[Servers]][%d] uses legacy single-server form (Hostname/Ip/Port at top level); "+
				"migrate to [[Servers.Instances]] in server.toml — auto-upgrading for now",
				label, i)
			c.Instances = []InstanceConfig{{
				Host:   c.Hostname,
				Ip:     c.Ip,
				Port:   c.Port,
				Weight: 1,
			}}
			// Zero the legacy fields so downstream code never sees both.
			c.Hostname, c.Ip, c.Port = "", "", 0
		case !legacy && !hasInstances:
			return fmt.Errorf("%s: [[Servers]][%d] (%s) has no instances", label, i, c.PubKeyBase64)
		}

		if err := c.LoadBalance.Validate(); err != nil {
			return fmt.Errorf("%s: [[Servers]][%d] (%s): %w", label, i, c.PubKeyBase64, err)
		}
		c.LoadBalance = c.LoadBalance.Normalize()

		for j := range c.Instances {
			inst := &c.Instances[j]
			if inst.Host == "" && inst.Ip == "" {
				return fmt.Errorf("%s: [[Servers]][%d] instance #%d: Host and Ip both empty", label, i, j)
			}
			if inst.Port <= 0 {
				return fmt.Errorf("%s: [[Servers]][%d] instance #%d: invalid Port %d", label, i, j, inst.Port)
			}
			if inst.Weight <= 0 {
				inst.Weight = 1
			}
		}
	}

	// Duplicate pubkey detection — two clusters with the same pubkey

View on GitHub (pinned to 6e04ca5ff0)