probelabs/goreplay · error

afpacket socket is only available on linux

Error message

afpacket socket is only available on linux

What it means

Platform stub: on non-Linux (or arm64/darwin builds per the build tag) capture.NewSocket has no AF_PACKET implementation, so any attempt to use the sock_raw listener gets this sentinel error instead of a socket.

Source

Thrown at internal/capture/sock_others.go:13

//go:build !linux || arm64 || darwin

package capture

import (
	"errors"

	"github.com/google/gopacket/pcap"
)

// NewSocket returns new M'maped sock_raw on packet version 2.
func NewSocket(_ pcap.Interface) (Socket, error) {
	return nil, errors.New("afpacket socket is only available on linux")
}

View on GitHub (pinned to 251e45abd2)

Solutions

  1. Run on Linux x86_64 where the real AF_PACKET socket implementation is compiled in
  2. Use the pcap-based listener instead of --input-raw-worker/sock_raw on unsupported platforms
  3. Switch capture engine if the build tag excluded sock_raw
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/capture/sock_others.go:13 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/6f596cd63adbce69. Report an issue: GitHub.