{"record":{"id":"f1b9f80e80f12b31","repo":"OpenNHP/opennhp","slug":"relay-server-s-instance-d-resolve-s-w","errorCode":null,"errorMessage":"relay: server %s instance #%d resolve %s: %w","messagePattern":"relay: server (.+?) instance #(.+?) resolve (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"endpoints/relay/relay.go","lineNumber":280,"sourceCode":"\tif c.StickyInstance != nil {\n\t\tsticky = *c.StickyInstance\n\t}\n\tcr := &serverRuntime{\n\t\tid:           id,\n\t\tname:         c.Name,\n\t\tpubKey:       pubKey,\n\t\tpubKeyBase64: c.PubKeyBase64,\n\t\tscheme:       c.LoadBalance,\n\t\tsticky:       sticky,\n\t\tinstances:    make([]*serverInstance, 0, len(c.Instances)),\n\t}\n\n\tfor j := range c.Instances {\n\t\tci := &c.Instances[j]\n\t\taddrStr := fmt.Sprintf(\"%s:%d\", ci.Host, ci.Port)\n\t\tudpAddr, err := net.ResolveUDPAddr(\"udp\", addrStr)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"relay: server %s instance #%d resolve %s: %w\", id, j, addrStr, err)\n\t\t}\n\n\t\t// Register the server's pubkey in the device peer table.\n\t\t// All siblings share one keypair so device.AddPeer (keyed by\n\t\t// pubkey) collapses them to a single entry — that's the\n\t\t// intent, not a bug. Routing to a specific instance happens\n\t\t// later via serverInstance.addr; validatePeer in the Noise\n\t\t// path only consults LookupPeer for pubkey-existence and\n\t\t// expiry, and uses ConnData.RemoteAddr (not Peer.Ip) for the\n\t\t// per-connection address stickiness check.\n\t\tpeer := &core.UdpPeer{\n\t\t\tPubKeyBase64: c.PubKeyBase64,\n\t\t\tIp:           ci.Host,\n\t\t\tPort:         ci.Port,\n\t\t\tType:         core.NHP_SERVER,\n\t\t\tExpireTime:   c.ExpireTime,\n\t\t}\n\t\trs.device.AddPeer(peer)","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/endpoints/relay/relay.go#L262-L298","documentation":"Raised in buildServer while registering an upstream instance: net.ResolveUDPAddr failed for the instance's Host:Port string. The configured address for that server instance cannot be parsed/resolved into a UDP endpoint (malformed host, bad port literal, or unresolvable hostname at load time).","triggerScenarios":"Thrown at endpoints/relay/relay.go:280 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the host/port pair named in the error message in the relay config","Use an IP literal if DNS is not available at relay startup","Verify the port is a number in range and no stray characters were pasted"],"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"}