{"record":{"id":"02a9ea9b1a5c7af1","repo":"OpenNHP/opennhp","slug":"s-servers-d-s-w","errorCode":null,"errorMessage":"%s: [[Servers]][%d] (%s): %w","messagePattern":"(.+?): \\[\\[Servers\\]\\]\\[(.+?)\\] \\((.+?)\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nhp/common/clusterconfig/clusterconfig.go","lineNumber":192,"sourceCode":"\t\t\t\tlabel, i, c.PubKeyBase64)\n\t\tcase legacy && !hasInstances:\n\t\t\tdeprecate(\"%s: [[Servers]][%d] uses legacy single-server form (Hostname/Ip/Port at top level); \"+\n\t\t\t\t\"migrate to [[Servers.Instances]] in server.toml — auto-upgrading for now\",\n\t\t\t\tlabel, i)\n\t\t\tc.Instances = []InstanceConfig{{\n\t\t\t\tHost:   c.Hostname,\n\t\t\t\tIp:     c.Ip,\n\t\t\t\tPort:   c.Port,\n\t\t\t\tWeight: 1,\n\t\t\t}}\n\t\t\t// Zero the legacy fields so downstream code never sees both.\n\t\t\tc.Hostname, c.Ip, c.Port = \"\", \"\", 0\n\t\tcase !legacy && !hasInstances:\n\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] (%s) has no instances\", label, i, c.PubKeyBase64)\n\t\t}\n\n\t\tif err := c.LoadBalance.Validate(); err != nil {\n\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] (%s): %w\", label, i, c.PubKeyBase64, err)\n\t\t}\n\t\tc.LoadBalance = c.LoadBalance.Normalize()\n\n\t\tfor j := range c.Instances {\n\t\t\tinst := &c.Instances[j]\n\t\t\tif inst.Host == \"\" && inst.Ip == \"\" {\n\t\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] instance #%d: Host and Ip both empty\", label, i, j)\n\t\t\t}\n\t\t\tif inst.Port <= 0 {\n\t\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] instance #%d: invalid Port %d\", label, i, j, inst.Port)\n\t\t\t}\n\t\t\tif inst.Weight <= 0 {\n\t\t\t\tinst.Weight = 1\n\t\t\t}\n\t\t}\n\t}\n\n\t// Duplicate pubkey detection — two clusters with the same pubkey","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/nhp/common/clusterconfig/clusterconfig.go#L174-L210","documentation":"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.","triggerScenarios":"Thrown at nhp/common/clusterconfig/clusterconfig.go:192 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the wrapped message to see the invalid loadBalance value and the list of valid schemes","Set loadBalance to an accepted scheme name or leave it empty to get the default","Correct the value in the server.toml entry identified by index/pubkey"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e04ca5ff03222a699c24205cd4bf8fee9af7ffe","analyzedAt":"2026-09-07T15:44:59.941Z","contentChangedAt":"2026-09-07T15:44:59.941Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}