{"record":{"id":"4816f0303e65aa66","repo":"slackhq/nebula","slug":"only-tcp-is-supported","errorCode":null,"errorMessage":"only tcp is supported","messagePattern":"only tcp is supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/service.go","lineNumber":212,"sourceCode":"\t\t\tPort: uint16(addr.Port),\n\t\t}\n\t\tnum := getProtocolNumber(addr.AddrPort().Addr())\n\t\treturn gonet.DialContextTCP(ctx, s.ipstack, fullAddr, num)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown network type: %s\", network)\n\t}\n}\n\n// Dial dials the provided address\nfunc (s *Service) Dial(network, address string) (net.Conn, error) {\n\treturn s.DialContext(context.Background(), network, address)\n}\n\n// Listen listens on the provided address. Currently only TCP with wildcard\n// addresses are supported.\nfunc (s *Service) Listen(network, address string) (net.Listener, error) {\n\tif network != \"tcp\" && network != \"tcp4\" {\n\t\treturn nil, errors.New(\"only tcp is supported\")\n\t}\n\taddr, err := net.ResolveTCPAddr(network, address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif addr.IP != nil && !bytes.Equal(addr.IP, []byte{0, 0, 0, 0}) {\n\t\treturn nil, fmt.Errorf(\"only wildcard address supported, got %q %v\", address, addr.IP)\n\t}\n\tif addr.Port == 0 {\n\t\treturn nil, errors.New(\"specific port required, got 0\")\n\t}\n\tif addr.Port < 0 || addr.Port >= math.MaxUint16 {\n\t\treturn nil, fmt.Errorf(\"invalid port %d\", addr.Port)\n\t}\n\tport := uint16(addr.Port)\n\n\tl := &tcpListener{\n\t\tport:   port,","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/service/service.go#L194-L230","documentation":"Service.Listen exposes a net.Listener over the nebula tunnel, but the underlying implementation only supports TCP. Passing any network other than \"tcp\" or \"tcp4\" returns this error immediately. UDP/unix/other network types are not implemented.","triggerScenarios":"Calling s.Listen(network, address) with network values like \"udp\", \"udp4\", \"unix\", \"tcp6\" (note tcp6 is rejected; only tcp and tcp4 pass).","commonSituations":"Porting code that used net.Listen with \"udp\"; assuming tcp6 works since the address may be IPv4-mapped; generic proxy code parameterizing the network string.","solutions":["Change the network argument to \"tcp\" or \"tcp4\".","Listen for UDP traffic via the tunnel with a different API — Service.Listen does not support datagram sockets.","Normalize tcp6 requests to tcp4 since only wildcard IPv4 addresses are supported."],"exampleFix":"// before\nln, err := s.Listen(\"udp\", \"127.0.0.1:8080\")\n// after\nln, err := s.Listen(\"tcp\", \"0.0.0.0:8080\")","handlingStrategy":"validation","validationCode":"if network != \"tcp\" && network != \"tcp4\" {\n    return fmt.Errorf(\"Service.Listen supports only tcp/tcp4, got %q\", network)\n}","typeGuard":null,"tryCatchPattern":"ln, err := s.Listen(network, address)\nif err != nil {\n    if err.Error() == \"only tcp is supported\" {\n        return fmt.Errorf(\"use network \\\"tcp\\\" or \\\"tcp4\\\" with Service.Listen\")\n    }\n    return err\n}","preventionTips":["Hardcode \"tcp\" (or map tcp6 → tcp4) when calling Service.Listen","Handle UDP needs with a separate mechanism — Listen is stream-only","Centralize listener creation so the network literal is validated once"],"tags":["service","network","tcp","nebula"],"backgroundTag":"unsupported-network-type","analyzedSha":"dd8f660c0ac37903ec4080ca4d3c861ba9342ceb","analyzedAt":"2026-09-03T11:13:55.444Z","contentChangedAt":"2026-09-03T11:13:55.444Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}