{"record":{"id":"f300927ae5c4320d","repo":"tailscale/tailscale","slug":"netstack-bind-v-v","errorCode":null,"errorMessage":"netstack: Bind(%v): %v","messagePattern":"netstack: Bind\\((.+?)\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgengine/netstack/netstack.go","lineNumber":1894,"sourceCode":"\t\tif !ap.Addr().Is6() {\n\t\t\treturn nil, fmt.Errorf(\"netstack: udp6 requires an IPv6 address\")\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"netstack: unsupported network %q\", network)\n\t}\n\tvar wq waiter.Queue\n\tep, nserr := ns.ipstack.NewEndpoint(udp.ProtocolNumber, networkProto, &wq)\n\tif nserr != nil {\n\t\treturn nil, fmt.Errorf(\"netstack: NewEndpoint: %v\", nserr)\n\t}\n\tlocalAddress := tcpip.FullAddress{\n\t\tNIC:  nicID,\n\t\tAddr: tcpip.AddrFromSlice(ap.Addr().AsSlice()),\n\t\tPort: ap.Port(),\n\t}\n\tif err := ep.Bind(localAddress); err != nil {\n\t\tep.Close()\n\t\treturn nil, fmt.Errorf(\"netstack: Bind(%v): %v\", localAddress, err)\n\t}\n\treturn gonet.NewUDPConn(&wq, ep), nil\n}\n\n// ListenTCP listens for TCP connections on the given address.\nfunc (ns *Impl) ListenTCP(network, address string) (*gonet.TCPListener, error) {\n\tap, err := netip.ParseAddrPort(address)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"netstack: ParseAddrPort(%q): %w\", address, err)\n\t}\n\n\tvar networkProto tcpip.NetworkProtocolNumber\n\tswitch network {\n\tcase \"tcp4\":\n\t\tnetworkProto = ipv4.ProtocolNumber\n\t\tif ap.Addr().IsValid() && !ap.Addr().Is4() {\n\t\t\treturn nil, fmt.Errorf(\"netstack: tcp4 requires an IPv4 address\")\n\t\t}","sourceCodeStart":1876,"sourceCodeEnd":1912,"githubUrl":"https://github.com/tailscale/tailscale/blob/5201273aec737d6372ab7423c31c04ca3ca2a0c2/wgengine/netstack/netstack.go#L1876-L1912","documentation":"ListenPacket created a gVisor UDP endpoint but binding it to the requested address and port on the netstack NIC failed, most often because the port is already in use inside the netstack. The endpoint is closed before returning.","triggerScenarios":"Thrown at wgengine/netstack/netstack.go:1868 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped bind error; the address/port may already be in use inside netstack or be invalid.","Choose a different local port or address that is free in the netstack."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5201273aec737d6372ab7423c31c04ca3ca2a0c2","analyzedAt":"2026-08-18T08:17:25.280Z","contentChangedAt":"2026-08-18T08:17:25.280Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}