{"record":{"id":"5702c60b14dafb61","repo":"probelabs/goreplay","slug":"monitor-mode-error-q-interface-q","errorCode":null,"errorMessage":"monitor mode error: %q, interface: %q","messagePattern":"monitor mode error: %q, interface: %q","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/capture/capture.go","lineNumber":427,"sourceCode":"\tdefer inactive.CleanUp()\n\n\tif l.config.TimestampType != \"\" && l.config.TimestampType != \"go\" {\n\t\tvar ts pcap.TimestampSource\n\t\tts, err = pcap.TimestampSourceFromString(l.config.TimestampType)\n\t\tfmt.Println(\"Setting custom Timestamp Source. Supported values: `go`, \", inactive.SupportedTimestamps())\n\t\terr = inactive.SetTimestampSource(ts)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%q: supported timestamps: %q, interface: %q\", err, inactive.SupportedTimestamps(), ifi.Name)\n\t\t}\n\t}\n\tif l.config.Promiscuous {\n\t\tif err = inactive.SetPromisc(l.config.Promiscuous); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"promiscuous mode error: %q, interface: %q\", err, ifi.Name)\n\t\t}\n\t}\n\tif l.config.Monitor {\n\t\tif err = inactive.SetRFMon(l.config.Monitor); err != nil && !errors.Is(err, pcap.CannotSetRFMon) {\n\t\t\treturn nil, fmt.Errorf(\"monitor mode error: %q, interface: %q\", err, ifi.Name)\n\t\t}\n\t}\n\n\tvar snap int\n\n\tif !l.config.Snaplen {\n\t\tinfs, _ := net.Interfaces()\n\t\tfor _, i := range infs {\n\t\t\tif i.Name == ifi.Name {\n\t\t\t\tsnap = i.MTU + 200\n\t\t\t}\n\t\t}\n\t}\n\n\tif snap == 0 {\n\t\tsnap = 64<<10 + 200\n\t}\n","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/probelabs/goreplay/blob/251e45abd242886bb64ff2b2dc98789556b56330/internal/capture/capture.go#L409-L445","documentation":"When config.Monitor is true, PcapHandle calls inactive.SetRFMon to request 802.11 monitor mode. The error is ignored when it matches pcap.CannotSetRFMon (per the errors.Is check), otherwise it is wrapped as \"monitor mode error: <err>, interface: <name>\". Monitor mode only makes sense on wireless interfaces and requires driver support.","triggerScenarios":"Setting l.config.Monitor = true on an interface whose driver/libpcap refuses SetRFMon with an error other than pcap.CannotSetRFMon, e.g. on wired Ethernet or unsupported Wi-Fi drivers.","commonSituations":"Enabling monitor mode on eth0 by mistake; Wi-Fi chipsets/drivers without monitor support; interfaces managed by NetworkManager that reject mode changes; macOS vs Linux capability differences.","solutions":["Only set config.Monitor = true for wireless interfaces (check iface.Flags / driver type)","Put the card into monitor mode beforehand (iw dev <iface> set monitor) or use airmon-ng, then capture without the Monitor flag","Check the driver supports monitor mode (iw list | grep monitor)","Leave the error ignored behavior as-is for CannotSetRFMon and fall back to normal capture"],"exampleFix":"// before\ncfg.Monitor = true // eth0 -> error\n// after\ncfg.Monitor = strings.HasPrefix(cfg.Iface, \"wlp\") && wifiSupportsMonitor(cfg.Iface)","handlingStrategy":"validation","validationCode":"if cfg.Monitor && !strings.HasPrefix(cfg.Iface, \"wl\") {\n    return fmt.Errorf(\"monitor mode requested on non-wireless interface %q\", cfg.Iface)\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"monitor mode error\") {\n    log.Warnf(\"monitor mode unavailable on %s, continuing in managed mode: %v\", ifi.Name, err)\n    cfg.Monitor = false\n    handle, err = l.PcapHandle(ifi)\n}","preventionTips":["Only enable Monitor on wireless interfaces with driver monitor support (iw list)","Pre-configure monitor mode with iw/airmon-ng instead of relying on SetRFMon","Rely on the library's CannotSetRFMon tolerance for wireless cards that refuse the option"],"tags":["go","pcap","monitor-mode","wifi"],"backgroundTag":"monitor-mode-not-supported","analyzedSha":"251e45abd242886bb64ff2b2dc98789556b56330","analyzedAt":"2026-09-02T16:44:11.369Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}