{"record":{"id":"ed8dc6979479012d","repo":"probelabs/goreplay","slug":"open-pcap-file-error-q","errorCode":null,"errorMessage":"open pcap file error: %q","messagePattern":"open pcap file error: %q","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/capture/capture.go","lineNumber":686,"sourceCode":"\t\t\tmsg += (\"\\n\" + e.Error())\n\t\t\tcontinue\n\t\t}\n\t\tl.Handles[ifi.Name] = packetHandle{\n\t\t\thandler: handle,\n\t\t\tips:     interfaceIPs(ifi),\n\t\t}\n\t}\n\tif len(l.Handles) == 0 {\n\t\treturn fmt.Errorf(\"raw socket handles error:%s\", msg)\n\t}\n\treturn nil\n}\n\nfunc (l *Listener) activatePcapFile() (err error) {\n\tvar handle *pcap.Handle\n\tvar e error\n\tif handle, e = pcap.OpenOffline(l.host); e != nil {\n\t\treturn fmt.Errorf(\"open pcap file error: %q\", e)\n\t}\n\n\ttmp := l.host\n\tl.host = \"\"\n\tl.config.BPFFilter = l.Filter(pcap.Interface{})\n\tl.host = tmp\n\n\tif e = handle.SetBPFFilter(l.config.BPFFilter); e != nil {\n\t\thandle.Close()\n\t\treturn fmt.Errorf(\"BPF filter error: %q, filter: %s\", e, l.config.BPFFilter)\n\t}\n\n\tfmt.Println(\"BPF Filter:\", l.config.BPFFilter)\n\n\tl.Handles[\"pcap_file\"] = packetHandle{\n\t\thandler: handle,\n\t}\n\treturn","sourceCodeStart":668,"sourceCodeEnd":704,"githubUrl":"https://github.com/probelabs/goreplay/blob/251e45abd242886bb64ff2b2dc98789556b56330/internal/capture/capture.go#L668-L704","documentation":"activatePcapFile wraps pcap.OpenOffline's failure to open the capture file given as the input host (missing file, bad permissions, or not a valid pcap/pcapng file), aborting replay from file.","triggerScenarios":"Thrown at internal/capture/capture.go:686 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the file path exists and is readable","Verify the file is a valid pcap capture produced by gor or tcpdump","Confirm correct file extension/format (gzip-compressed files need matching support)"],"exampleFix":null,"handlingStrategy":"try-catch","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"}