probelabs/goreplay · error
open pcap file error: %q
Error message
open pcap file error: %q
What it means
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.
Source
Thrown at internal/capture/capture.go:686
msg += ("\n" + e.Error())
continue
}
l.Handles[ifi.Name] = packetHandle{
handler: handle,
ips: interfaceIPs(ifi),
}
}
if len(l.Handles) == 0 {
return fmt.Errorf("raw socket handles error:%s", msg)
}
return nil
}
func (l *Listener) activatePcapFile() (err error) {
var handle *pcap.Handle
var e error
if handle, e = pcap.OpenOffline(l.host); e != nil {
return fmt.Errorf("open pcap file error: %q", e)
}
tmp := l.host
l.host = ""
l.config.BPFFilter = l.Filter(pcap.Interface{})
l.host = tmp
if e = handle.SetBPFFilter(l.config.BPFFilter); e != nil {
handle.Close()
return fmt.Errorf("BPF filter error: %q, filter: %s", e, l.config.BPFFilter)
}
fmt.Println("BPF Filter:", l.config.BPFFilter)
l.Handles["pcap_file"] = packetHandle{
handler: handle,
}
returnView on GitHub (pinned to 251e45abd2)
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)
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/capture/capture.go:686 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of probelabs/goreplay@251e45abd2 (2026-09-02).
Data as JSON: /api/errors/ed8dc6979479012d.
Report an issue: GitHub.