Pumpkin-MC/Pumpkin · error · PacketDecodeError

packet exceeds maximum length

Error message

packet exceeds maximum length

What it means

PacketDecodeError variant fired when a decoded packet's declared or actual length exceeds the protocol's maximum allowed packet size — a classic decompression-bomb / oversize-packet guard applied while reading.

Solutions

  1. Disconnect the client sending the oversized packet
  2. Enforce the max packet length before allocating buffers
  3. Log the attempted size at warn level
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/pumpkin-protocol/src/lib.rs:303 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09). Data as JSON: /api/errors/3da7f546914f6d3f. Report an issue: GitHub.

Appendix: source

Thrown at crates/pumpkin-protocol/src/lib.rs:303

    fn read(read: impl Read) -> Result<Self, Error>;
}

/// Errors that can occur during packet encoding.
#[derive(Error, Debug)]
pub enum PacketEncodeError {
    #[error("Packet exceeds maximum length: {0}")]
    TooLong(usize),
    #[error("Compression failed {0}")]
    CompressionFailed(String),
    #[error("Writing packet failed: {0}")]
    Message(String),
}

#[derive(Error, Debug)]
pub enum PacketDecodeError {
    #[error("failed to decode packet ID")]
    DecodeID,
    #[error("packet exceeds maximum length")]
    TooLong,
    #[error("packet length is out of bounds")]
    OutOfBounds,
    #[error("malformed packet length VarInt: {0}")]
    MalformedLength(String),
    #[error("failed to decompress packet: {0}")]
    FailedDecompression(String), // Updated to include error details
    #[error("packet is uncompressed but greater than the threshold")]
    NotCompressed,
    #[error("the connection has closed")]
    ConnectionClosed,
    #[error("{0}")]
    Message(String),
}

impl From<ReadingError> for PacketDecodeError {
    fn from(value: ReadingError) -> Self {
        Self::FailedDecompression(value.to_string())

View on GitHub (pinned to 8d4639e25a)