{"record":{"id":"5beab234e70c600b","repo":"OpenNHP/opennhp","slug":"s-servers-d-s-sets-both-top-level-ip-ho","errorCode":null,"errorMessage":"%s: [[Servers]][%d] (%s) sets both top-level Ip/Hostname/Port and [[Servers.Instances]]; pick one form — top-level fields are deprecated, prefer Instances","messagePattern":"(.+?): \\[\\[Servers\\]\\]\\[(.+?)\\] \\((.+?)\\) sets both top-level Ip/Hostname/Port and \\[\\[Servers\\.Instances\\]\\]; pick one form — top-level fields are deprecated, prefer Instances","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nhp/common/clusterconfig/clusterconfig.go","lineNumber":172,"sourceCode":"\t\t\tif len(c.Name) > NameMaxLen {\n\t\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] Name %q exceeds %d chars\",\n\t\t\t\t\tlabel, i, c.Name, NameMaxLen)\n\t\t\t}\n\t\t\tif !clusterNameRegex.MatchString(c.Name) {\n\t\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] Name %q invalid — allowed chars: [a-zA-Z0-9._-]\",\n\t\t\t\t\tlabel, i, c.Name)\n\t\t\t}\n\t\t}\n\n\t\tlegacy := c.hasLegacyFields()\n\t\thasInstances := len(c.Instances) > 0\n\n\t\tswitch {\n\t\tcase legacy && hasInstances:\n\t\t\t// Both forms in one entry is almost certainly an\n\t\t\t// incomplete migration. Refuse to guess which one the\n\t\t\t// operator meant.\n\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] (%s) sets both top-level Ip/Hostname/Port and [[Servers.Instances]]; \"+\n\t\t\t\t\"pick one form — top-level fields are deprecated, prefer Instances\",\n\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","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/nhp/common/clusterconfig/clusterconfig.go#L154-L190","documentation":"Cluster-config validation error from Normalize: one [[Servers]] entry declares both the deprecated top-level Ip/Hostname/Port fields and a [[Servers.Instances]] sub-table. This almost always indicates an incomplete migration, and the loader refuses to guess which form the operator meant, so it rejects the entry instead of silently picking one address set.","triggerScenarios":"Thrown at nhp/common/clusterconfig/clusterconfig.go:172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Delete the deprecated top-level Ip/Hostname/Port fields from the entry","Keep the [[Servers.Instances]] block as the single source of addresses","Repeat for every entry flagged by the error"],"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"}