{"record":{"id":"76206e10567236d4","repo":"fatedier/frp","slug":"sudp-resolveudpaddr-error-v","errorCode":null,"errorMessage":"sudp ResolveUDPAddr error: %v","messagePattern":"sudp ResolveUDPAddr error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/visitor/sudp.go","lineNumber":51,"sourceCode":"type SUDPVisitor struct {\n\t*BaseVisitor\n\n\tcheckCloseCh chan struct{}\n\t// udpConn is the listener of udp packet\n\tudpConn *net.UDPConn\n\treadCh  chan *msg.UDPPacket\n\tsendCh  chan *msg.UDPPacket\n\n\tcfg *v1.SUDPVisitorConfig\n}\n\n// SUDP Run start listen a udp port\nfunc (sv *SUDPVisitor) Run() (err error) {\n\txl := xlog.FromContextSafe(sv.ctx)\n\n\taddr, err := net.ResolveUDPAddr(\"udp\", net.JoinHostPort(sv.cfg.BindAddr, strconv.Itoa(sv.cfg.BindPort)))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"sudp ResolveUDPAddr error: %v\", err)\n\t}\n\n\tsv.udpConn, err = net.ListenUDP(\"udp\", addr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"listen udp port %s error: %v\", addr.String(), err)\n\t}\n\n\tsv.sendCh = make(chan *msg.UDPPacket, 1024)\n\tsv.readCh = make(chan *msg.UDPPacket, 1024)\n\n\txl.Infof(\"sudp start to work, listen on %s\", addr)\n\n\tgo sv.dispatcher()\n\tgo udp.ForwardUserConn(sv.udpConn, sv.readCh, sv.sendCh, int(sv.clientCfg.UDPPacketSize))\n\n\treturn\n}\n","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/fatedier/frp/blob/6c8a8d0a97d03b44e9528d30b30c70cb9d61b405/client/visitor/sudp.go#L33-L69","documentation":"Thrown by SUDPVisitor.Run when net.ResolveUDPAddr fails to parse the bind address for the secret UDP visitor — i.e. the combination of cfg.BindAddr and cfg.BindPort is not a valid UDP address. This is a pure configuration error; no socket is opened yet.","triggerScenarios":"A sudp visitor with bindAddr set to an invalid host string (unresolvable name at parse time like \"my host\", malformed IPv6, empty-with-bad-port) or bindPort outside 0-65535 (e.g. a negative number or >65535 from templating).","commonSituations":"Templated configs injecting an unset variable producing garbage; IPv6 literal missing brackets; port computed dynamically overflowing 65535; copy-paste errors in bindAddr.","solutions":["Set bindAddr to a valid IP or hostname (use \"127.0.0.1\" for local-only, \"0.0.0.0\" for all interfaces).","Ensure bindPort is an integer in 0-65535.","Wrap IPv6 literals in brackets when combined with a port, or rely on the separate bindPort field.","Validate the address with net.ResolveUDPAddr in your config tooling before deploying."],"exampleFix":"# before (frpc.toml)\n[[visitors]]\nname = \"v\"\ntype = \"sudp\"\n[visitors.sudp]\nbindAddr = \"my host\"\nbindPort = 70000\n\n# after\n[visitors.sudp]\nbindAddr = \"127.0.0.1\"\nbindPort = 6000","handlingStrategy":"validation","validationCode":"// Pre-validate the visitor bind address exactly as Run() will build it\nif _, err := net.ResolveUDPAddr(\"udp\", net.JoinHostPort(bindAddr, strconv.Itoa(bindPort))); err != nil {\n    return fmt.Errorf(\"invalid sudp visitor bind address: %w\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use plain IPs (127.0.0.1) for bindAddr in visitor configs.","Keep bindPort within 0-65535 and never inject unvalidated template vars.","Pre-resolve addresses in config tooling."],"tags":["udp","visitor","config","sudp"],"backgroundTag":null,"analyzedSha":"6c8a8d0a97d03b44e9528d30b30c70cb9d61b405","analyzedAt":"2026-08-15T06:53:27.215Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}