{"record":{"id":"34d3123afec06dbb","repo":"probelabs/goreplay","slug":"can-t-find-matching-interface","errorCode":null,"errorMessage":"can't find matching interface","messagePattern":"can't find matching interface","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/capture/sock_linux.go","lineNumber":63,"sourceCode":"\tloopIndex   int32  // this field must filled to avoid reading packet twice on a loopback device\n}\n\n// NewSocket returns new M'maped sock_raw on packet version 2.\nfunc NewSocket(pifi pcap.Interface) (*SockRaw, error) {\n\tvar ifi net.Interface\n\n\tinfs, _ := net.Interfaces()\n\tfound := false\n\tfor _, i := range infs {\n\t\tif i.Name == pifi.Name {\n\t\t\tifi = i\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"can't find matching interface\")\n\t}\n\n\t// sock create\n\tfd, err := unix.Socket(unix.AF_PACKET, unix.SOCK_RAW, int(ETHALL))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsock := &SockRaw{\n\t\tfd:          fd,\n\t\tifindex:     ifi.Index,\n\t\tsnaplen:     FRAMESIZE,\n\t\tpollTimeout: ^uintptr(0),\n\t}\n\n\t// set packet version\n\terr = unix.SetsockoptInt(fd, unix.SOL_PACKET, unix.PACKET_VERSION, unix.TPACKET_V2)\n\tif err != nil {\n\t\tunix.Close(fd)","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/probelabs/goreplay/blob/251e45abd242886bb64ff2b2dc98789556b56330/internal/capture/sock_linux.go#L45-L81","documentation":"sock_linux NewSocket walks net.Interfaces() to find the kernel interface matching the pcap.Interface name; no match means the pcap interface list and the kernel's are out of sync (renamed, removed, or unexposed interface), so the socket is not created.","triggerScenarios":"Thrown at internal/capture/sock_linux.go:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the interface name with 'ip link' right before starting gor","Handle interfaces that disappear/rename dynamically (re-run discovery)","Avoid passing virtual/pcap-only device names that net.Interfaces won't return"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"251e45abd242886bb64ff2b2dc98789556b56330","analyzedAt":"2026-09-02T16:44:11.369Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}