Pumpkin-MC/Pumpkin · error · PacketDecodeError
malformed packet length VarInt
Error message
malformed packet length VarInt: {0} What it means
PacketDecodeError variant raised while reading the framed packet's length prefix: the VarInt decoder itself failed while parsing the length field (overflow or malformed continuation). The faulty input is the length VarInt bytes at the start of the frame — truncated or corrupted data on the connection.
Solutions
- Close the connection; framing cannot be resynchronized
- Validate VarInt encoding before consuming the body
- Log the malformed length at debug level
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/pumpkin-protocol/src/lib.rs:307 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09).
Data as JSON: /api/errors/0650e57292f412b5.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin-protocol/src/lib.rs:307
#[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())
}
}
#[derive(Clone, serde::Serialize)]View on GitHub (pinned to 8d4639e25a)