tailscale/tailscale · error

packet too large

Error message

packet too large

What it means

errLargePacket: sentinel returned by header Marshal implementations (e.g. ICMP4Header.Marshal, ICMP6Header.Marshal) when the buffer/payload exceeds maxPacketLength (64KiB), the largest size representable in the headers' length fields.

Source

Thrown at net/packet/header.go:26

	"math"
)

const igmpHeaderLength = 8
const tcpHeaderLength = 20
const sctpHeaderLength = 12

// maxPacketLength is the largest length that all headers support.
// IPv4 headers using uint16 for this forces an upper bound of 64KB.
const maxPacketLength = math.MaxUint16

var (
	// errSmallBuffer is returned when Marshal receives a buffer
	// too small to contain the header to marshal.
	errSmallBuffer = errors.New("buffer too small")
	// errLargePacket is returned when Marshal receives a payload
	// larger than the maximum representable size in header
	// fields.
	errLargePacket = errors.New("packet too large")
)

// Header is a packet header capable of marshaling itself into a byte
// buffer.
type Header interface {
	// Len returns the length of the marshaled packet.
	Len() int
	// Marshal serializes the header into buf, which must be at
	// least Len() bytes long. Implementations of Marshal assume
	// that bytes after the first Len() are payload bytes for the
	// purpose of computing length and checksum fields. Marshal
	// implementations must not allocate memory.
	Marshal(buf []byte) error
}

// HeaderChecksummer is implemented by Header implementations that
// need to do a checksum over their payloads.
type HeaderChecksummer interface {

View on GitHub (pinned to 6e0912f979)

Solutions

  1. Fragment or split the payload so each packet is ≤64KB
  2. Reject oversized packets at the sender before marshaling
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at net/packet/header.go:26 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tailscale/tailscale@6e0912f979 (2026-08-18). Data as JSON: /api/errors/d763cd2a9476af48. Report an issue: GitHub.