{"record":{"id":"d763cd2a9476af48","repo":"tailscale/tailscale","slug":"packet-too-large","errorCode":null,"errorMessage":"packet too large","messagePattern":"packet too large","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"net/packet/header.go","lineNumber":26,"sourceCode":"\t\"math\"\n)\n\nconst igmpHeaderLength = 8\nconst tcpHeaderLength = 20\nconst sctpHeaderLength = 12\n\n// maxPacketLength is the largest length that all headers support.\n// IPv4 headers using uint16 for this forces an upper bound of 64KB.\nconst maxPacketLength = math.MaxUint16\n\nvar (\n\t// errSmallBuffer is returned when Marshal receives a buffer\n\t// too small to contain the header to marshal.\n\terrSmallBuffer = errors.New(\"buffer too small\")\n\t// errLargePacket is returned when Marshal receives a payload\n\t// larger than the maximum representable size in header\n\t// fields.\n\terrLargePacket = errors.New(\"packet too large\")\n)\n\n// Header is a packet header capable of marshaling itself into a byte\n// buffer.\ntype Header interface {\n\t// Len returns the length of the marshaled packet.\n\tLen() int\n\t// Marshal serializes the header into buf, which must be at\n\t// least Len() bytes long. Implementations of Marshal assume\n\t// that bytes after the first Len() are payload bytes for the\n\t// purpose of computing length and checksum fields. Marshal\n\t// implementations must not allocate memory.\n\tMarshal(buf []byte) error\n}\n\n// HeaderChecksummer is implemented by Header implementations that\n// need to do a checksum over their payloads.\ntype HeaderChecksummer interface {","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/tailscale/tailscale/blob/6e0912f97994f927632b34ae9e63b53d6516a6ac/net/packet/header.go#L8-L44","documentation":"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.","triggerScenarios":"Thrown at net/packet/header.go:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fragment or split the payload so each packet is ≤64KB","Reject oversized packets at the sender before marshaling"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e0912f97994f927632b34ae9e63b53d6516a6ac","analyzedAt":"2026-08-18T08:17:25.280Z","contentChangedAt":"2026-08-18T08:17:25.280Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}