Pumpkin-MC/Pumpkin · error · PacketDecodeError

the connection has closed

Error message

the connection has closed

What it means

PacketDecodeError sentinel returned when reading from the socket returned EOF/0 bytes while a packet was expected. It signals normal or abnormal connection termination during decode — the peer closed the connection mid-stream; no particular input field is at fault.

Solutions

  1. Stop reading and clean up the connection state
  2. Treat as a normal disconnect rather than an error for logging
  3. Notify disconnect handlers for the player
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/pumpkin-protocol/src/lib.rs:313 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/6c4f5353f9064016. Report an issue: GitHub.

Appendix: source

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

    #[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())
    }
}

#[derive(Clone, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StatusResponse {
    /// The version on which the server is running. (Optional)
    pub version: Option<Version>,
    /// Information about currently connected players. (Optional)
    pub players: Option<Players>,

View on GitHub (pinned to 8d4639e25a)