OpenNHP/opennhp · error

relay: server # (fingerprint ) loadBalance is not one of

Error message

relay: server #%d (fingerprint %s) loadBalance %q is not one of: %q, %q, %q

What it means

Raised during config normalization (normalize) when a server entry's LoadBalance string is neither empty nor one of the accepted schemes. The check exists because a typo like 'weighted_random' or 'roundrobin' would otherwise silently fall back to the default policy once multi-instance load balancing is enabled, so the operator is told at load time instead.

Solutions

  1. Correct the loadBalance value to one of the accepted scheme names
  2. Copy the exact spelling from the error message, which enumerates the valid options
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at endpoints/relay/config.go:276 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/abb0bf0f4ed49183. Report an issue: GitHub.

Appendix: source

Thrown at endpoints/relay/config.go:276

					i, j, addr, dup.server, dup.instance, fp)
			}
			seenAddr[addrKey] = addrOrigin{server: i, instance: j}
			if inst.Weight <= 0 {
				inst.Weight = 1
			}
		}
		switch c.LoadBalance {
		case "":
			c.LoadBalance = LBWeightedRandom
		case LBRandom, LBWeightedRandom, LBRoundRobin:
			// known scheme, keep as-is
		default:
			// Typos like "weighted_random" or "roundrobin" are harmless in
			// phase 1 (the value is unused with a single instance) but
			// would silently degrade phase-2 load balancing to whatever
			// the default policy is. Reject at load time so the operator
			// hears about it now, not after a later upgrade.
			return fmt.Errorf("relay: server #%d (fingerprint %s) loadBalance %q is not one of: %q, %q, %q",
				i, fp, c.LoadBalance, LBRandom, LBWeightedRandom, LBRoundRobin)
		}
	}

	return nil
}

View on GitHub (pinned to 6e04ca5ff0)