probelabs/goreplay · error

sock raw error: %q, interface: %q

Error message

sock raw error: %q, interface: %q

What it means

SocketHandle wraps the failure of capture.NewSocket to create the AF_PACKET raw socket for the interface (missing implementation on this platform, interface not found, or socket syscall/setsockopt errors).

Source

Thrown at internal/capture/capture.go:485

	bpfFilter := l.config.BPFFilter
	if bpfFilter == "" {
		bpfFilter = l.Filter(ifi)
	}
	fmt.Println("Interface:", ifi.Name, ". BPF Filter:", bpfFilter)
	err = handle.SetBPFFilter(bpfFilter)
	if err != nil {
		handle.Close()
		return nil, fmt.Errorf("BPF filter error: %q%s, interface: %q", err, bpfFilter, ifi.Name)
	}
	return
}

// SocketHandle returns new unix ethernet handle associated with this listener settings
func (l *Listener) SocketHandle(ifi pcap.Interface) (handle Socket, err error) {
	handle, err = NewSocket(ifi)
	if err != nil {
		return nil, fmt.Errorf("sock raw error: %q, interface: %q", err, ifi.Name)
	}
	if err = handle.SetPromiscuous(l.config.Promiscuous || l.config.Monitor); err != nil {
		return nil, fmt.Errorf("promiscuous mode error: %q, interface: %q", err, ifi.Name)
	}
	if l.config.BPFFilter == "" {
		l.config.BPFFilter = l.Filter(ifi)
	}
	fmt.Println("BPF Filter: ", l.config.BPFFilter)
	if err = handle.SetBPFFilter(l.config.BPFFilter); err != nil {
		handle.Close()
		return nil, fmt.Errorf("BPF filter error: %q%s, interface: %q", err, l.config.BPFFilter, ifi.Name)
	}
	handle.SetLoopbackIndex(int32(l.loopIndex))
	return
}

func http1StartHint(pckt *tcp.Packet) (isRequest, isResponse bool) {
	if proto.HasRequestTitle(pckt.Payload) {

View on GitHub (pinned to 251e45abd2)

Solutions

  1. Confirm Linux support: sock_raw needs AF_PACKET and root or CAP_NET_RAW
  2. Check the interface name exists in net.Interfaces at socket creation time
  3. Read the wrapped inner error — it names the exact failing syscall or platform limitation
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/capture/capture.go:485 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/9297cb54eb9396bc. Report an issue: GitHub.