{"record":{"id":"23d56c34194aa524","repo":"micro/go-micro","slug":"failed-to-join-multicast-group-on-all-interfaces","errorCode":null,"errorMessage":"failed to join multicast group on all interfaces","messagePattern":"failed to join multicast group on all interfaces","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/mdns/client.go","lineNumber":241,"sourceCode":"\n\tifaces, err := net.Interfaces()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar errCount1, errCount2 int\n\n\tfor _, iface := range ifaces {\n\t\tif err := p1.JoinGroup(&iface, &net.UDPAddr{IP: mdnsGroupIPv4}); err != nil {\n\t\t\terrCount1++\n\t\t}\n\t\tif err := p2.JoinGroup(&iface, &net.UDPAddr{IP: mdnsGroupIPv6}); err != nil {\n\t\t\terrCount2++\n\t\t}\n\t}\n\n\tif len(ifaces) == errCount1 && len(ifaces) == errCount2 {\n\t\treturn nil, fmt.Errorf(\"failed to join multicast group on all interfaces\")\n\t}\n\n\tc := &client{\n\t\tipv4MulticastConn: mconn4,\n\t\tipv6MulticastConn: mconn6,\n\t\tipv4UnicastConn:   uconn4,\n\t\tipv6UnicastConn:   uconn6,\n\t\tclosedCh:          make(chan struct{}),\n\t}\n\treturn c, nil\n}\n\n// Close is used to cleanup the client.\nfunc (c *client) Close() error {\n\tc.closeLock.Lock()\n\tdefer c.closeLock.Unlock()\n\n\tif c.closed {","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/internal/util/mdns/client.go#L223-L259","documentation":"After binding, the mDNS client calls JoinGroup on every interface for the IPv4 and IPv6 multicast groups. If joining failed on ALL interfaces for both address families, the client cannot receive multicast traffic and construction fails with this error.","triggerScenarios":"newClient (via Query or Listen) when errCount1 and errCount2 both equal len(ifaces), i.e. JoinGroup failed for every interface on both IPv4 and IPv6.","commonSituations":"VMs/containers with interfaces lacking multicast capability (no MULTICAST flag); VPN or dummy interfaces only; kernels with IPv6 multicast disabled; running without needed privileges.","solutions":["Ensure at least one interface has the MULTICAST flag enabled (ip link set dev eth0 multicast on)","Verify the interface list is non-empty and includes a real NIC or loopback with multicast","Check host/VM settings that disable multicast or IPv6","Run with sufficient privileges (CAP_NET_RAW / not restricted by sandbox)"],"exampleFix":"// shell check before running the app\nip -o link | grep MULTICAST || ip link set dev eth0 multicast on","handlingStrategy":"fallback","validationCode":"ifaces, _ := net.Interfaces()\nmulticastOK := false\nfor _, i := range ifaces {\n    if i.Flags&net.FlagMulticast != 0 && i.Flags&net.FlagUp != 0 {\n        multicastOK = true\n    }\n}\nif !multicastOK {\n    log.Fatal(\"no multicast-capable interface available\")\n}","typeGuard":null,"tryCatchPattern":"c, err := newClient(config)\nif err != nil && strings.Contains(err.Error(), \"failed to join multicast group on all interfaces\") {\n    // degrade: use unicast discovery or polling fallback\n    return nil, fmt.Errorf(\"multicast unsupported in this environment: %w\", err)\n}","preventionTips":["Enable the MULTICAST flag on at least one interface before deployment","Avoid VM/container NICs without multicast support for mDNS workloads","Test multicast join in CI environments matching production networking"],"tags":["network","multicast","mdns","interfaces"],"backgroundTag":"multicast-join-failure","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}