{"record":{"id":"ad8b79a46d5a7eb4","repo":"OpenNHP/opennhp","slug":"s-servers-d-instance-d-host-and-ip-both","errorCode":null,"errorMessage":"%s: [[Servers]][%d] instance #%d: Host and Ip both empty","messagePattern":"(.+?): \\[\\[Servers\\]\\]\\[(.+?)\\] instance #(.+?): Host and Ip both empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nhp/common/clusterconfig/clusterconfig.go","lineNumber":199,"sourceCode":"\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\n\t// would race for the same slot in device.peerMap. Catch it here\n\t// so the error is obvious at load rather than as a mysterious\n\t// \"wrong instance answered\" at runtime.\n\tseenPK := make(map[string]int, len(clusters))\n\tfor i, c := range clusters {\n\t\tif prev, ok := seenPK[c.PubKeyBase64]; ok {\n\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] and [[Servers]][%d] share PubKeyBase64 %s — \"+","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/nhp/common/clusterconfig/clusterconfig.go#L181-L217","documentation":"Cluster-config validation error from Normalize while iterating a server's Instances: an instance declares neither Host nor Ip, so there is no address to dial. The instance index and server entry are included in the message to locate the empty block in server.toml.","triggerScenarios":"Thrown at nhp/common/clusterconfig/clusterconfig.go:199 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set Host (FQDN) or Ip on the flagged [[Servers.Instances]] entry","Remove the instance block entirely if the endpoint is no longer used"],"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"}