{"record":{"id":"bb9ae7dc37e68d1d","repo":"ginuerzh/gost","slug":"socks5-udp-tunnel-failure","errorCode":null,"errorMessage":"socks5 UDP tunnel failure","messagePattern":"socks5 UDP tunnel failure","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"socks.go","lineNumber":1934,"sourceCode":"\treq := gosocks5.NewRequest(CmdUDPTun, toSocksAddr(raddr))\n\tif err := req.Write(cc); err != nil {\n\t\treturn nil, err\n\t}\n\tif Debug {\n\t\tlog.Log(\"[socks5] udp-tun\", req)\n\t}\n\n\treply, err := gosocks5.ReadReply(cc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif Debug {\n\t\tlog.Log(\"[socks5] udp-tun\", reply)\n\t}\n\n\tif reply.Rep != gosocks5.Succeeded {\n\t\treturn nil, errors.New(\"socks5 UDP tunnel failure\")\n\t}\n\n\tbaddr, err := net.ResolveUDPAddr(\"udp\", reply.Addr.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Logf(\"[socks5] udp-tun associate on %s OK\", baddr)\n\n\treturn &socks5UDPTunnelConn{\n\t\tConn:  cc,\n\t\ttaddr: taddr,\n\t}, nil\n}\n\nfunc (c *socks5UDPTunnelConn) Read(b []byte) (n int, err error) {\n\tn, _, err = c.ReadFrom(b)\n\treturn\n}","sourceCodeStart":1916,"sourceCodeEnd":1952,"githubUrl":"https://github.com/ginuerzh/gost/blob/a33fdbf4c98034f4bfeeaea9868909822b9c526d/socks.go#L1916-L1952","documentation":"Returned by the SOCKS5 UDP-over-TCP tunnel code when the server's reply to a CmdUDPTun associate request carries a Rep code other than Succeeded. The TCP control connection is fine, but the server refused to allocate the UDP relay endpoint, so no UDP tunnel can be established.","triggerScenarios":"Thrown at socks.go:1934 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check whether the SOCKS5 server supports the UDP ASSOCIATE/udp-tun command","Verify the server's UDP relay port is open and not blocked by a firewall","Confirm server-side ACLs allow UDP relay for the requesting client","Retry against a different proxy node that permits UDP forwarding"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a33fdbf4c98034f4bfeeaea9868909822b9c526d","analyzedAt":"2026-09-02T22:15:54.506Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}