{"record":{"id":"a7b5e7cd02f45673","repo":"micro/go-micro","slug":"failed-to-join-multicast-group-on-all-interfaces-a7b5e7","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/server.go","lineNumber":132,"sourceCode":"\t\tif err := p2.JoinGroup(config.Iface, &net.UDPAddr{IP: mdnsGroupIPv6}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tifaces, err := net.Interfaces()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terrCount1, errCount2 := 0, 0\n\t\tfor _, iface := range ifaces {\n\t\t\tif err := p1.JoinGroup(&iface, &net.UDPAddr{IP: mdnsGroupIPv4}); err != nil {\n\t\t\t\terrCount1++\n\t\t\t}\n\t\t\tif err := p2.JoinGroup(&iface, &net.UDPAddr{IP: mdnsGroupIPv6}); err != nil {\n\t\t\t\terrCount2++\n\t\t\t}\n\t\t}\n\t\tif len(ifaces) == errCount1 && len(ifaces) == errCount2 {\n\t\t\treturn nil, fmt.Errorf(\"failed to join multicast group on all interfaces\")\n\t\t}\n\t}\n\n\tipFunc := getOutboundIP\n\tif config.GetMachineIP != nil {\n\t\tipFunc = config.GetMachineIP\n\t}\n\n\ts := &Server{\n\t\tconfig:     config,\n\t\tipv4List:   ipv4List,\n\t\tipv6List:   ipv6List,\n\t\tshutdownCh: make(chan struct{}),\n\t\toutboundIP: ipFunc(),\n\t}\n\n\tgo s.recv(s.ipv4List)\n\tgo s.recv(s.ipv6List)","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/internal/util/mdns/server.go#L114-L150","documentation":"NewServer joins the mDNS multicast group on each interface for IPv4 and IPv6. If JoinGroup fails on every interface for both families, the server cannot receive multicast queries and returns this error. This mirrors the client-side check but occurs during server construction.","triggerScenarios":"NewServer (Register, TestServer_StartStop, TestServer_Lookup) when both error counters equal len(ifaces) after JoinGroup attempts on all interfaces.","commonSituations":"Interfaces without MULTICAST flag; containers/VMs whose virtual NICs don't support multicast; IPv6 multicast disabled in kernel; restricted sandbox privileges.","solutions":["Enable multicast on at least one interface (ip link set dev eth0 multicast on)","Verify a real interface with multicast support exists and is up","Check that IPv6/IPv4 multicast is enabled in the host kernel and network","Run the process with network privileges that permit joining multicast groups"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"var joined, total int\nifaces, _ := net.Interfaces()\nfor _, i := range ifaces {\n    if i.Flags&net.FlagMulticast == 0 { continue }\n    total++\n    _ = joined // probe joinability via a test socket if needed\n}\nif total == 0 {\n    log.Fatal(\"no multicast-capable interfaces; mDNS server cannot run\")\n}","typeGuard":null,"tryCatchPattern":"srv, err := mdns.NewServer(&mdns.Config{Zone: zone})\nif err != nil && strings.Contains(err.Error(), \"failed to join multicast group on all interfaces\") {\n    return nil, fmt.Errorf(\"multicast join failed on all interfaces; enable multicast on a NIC: %w\", err)\n}","preventionTips":["Ensure interfaces have MULTICAST and UP flags in deployment manifests","Verify IPv6 multicast support if relying on the udp6 path","Run integration tests on the same network stack as production"],"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"}