{"record":{"id":"842cca6d6c6f1b7b","repo":"probelabs/goreplay","slug":"bpf-filter-error-q-filter-s","errorCode":null,"errorMessage":"BPF filter error: %q, filter: %s","messagePattern":"BPF filter error: %q, filter: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/capture/capture.go","lineNumber":696,"sourceCode":"\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\n}\n\nfunc (l *Listener) activateAFPacket() error {\n\tszFrame, szBlock, numBlocks, err := afpacketComputeSize(32, 32<<10, os.Getpagesize())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar msg string\n\tfor _, ifi := range l.Interfaces {","sourceCodeStart":678,"sourceCodeEnd":714,"githubUrl":"https://github.com/probelabs/goreplay/blob/251e45abd242886bb64ff2b2dc98789556b56330/internal/capture/capture.go#L678-L714","documentation":"activatePcapFile fails when the BPF filter derived for the offline file cannot be applied via SetBPFFilter; the handle is closed and the error names the exact filter string that was rejected.","triggerScenarios":"Thrown at internal/capture/capture.go:696 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the --input-raw-bpf-filter expression for syntax errors","Test the filter against the file with tcpdump -r <file> '<filter>'","Simplify the filter to isolate which clause is invalid"],"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"}