{"record":{"id":"ff0231e289092342","repo":"Pumpkin-MC/Pumpkin","slug":"io-error-0","errorCode":null,"errorMessage":"IO error: {0}","messagePattern":"IO error: (.+?)","errorType":"exception","errorClass":"AdvancementDataError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin/src/entity/player/advancement.rs","lineNumber":245,"sourceCode":"\nimpl AdvancementAward {\n    #[must_use]\n    pub(crate) const fn awarded(self) -> bool {\n        self.awarded\n    }\n\n    pub(crate) const fn combine(self, other: Self) -> Self {\n        Self {\n            awarded: self.awarded || other.awarded,\n            completed: self.completed || other.completed,\n        }\n    }\n}\n\n/// Errors that can occur when saving or loading advancement data.\n#[derive(Debug, thiserror::Error)]\npub enum AdvancementDataError {\n    #[error(\"IO error: {0}\")]\n    Io(std::io::Error),\n    #[error(\"JSON error: {0}\")]\n    Json(serde_json::Error),\n}\n\nimpl PlayerAdvancement {\n    /// Creates a new instance of `PlayerAdvancement`.\n    #[must_use]\n    pub fn new(manager: Arc<AdvancementManager>, uuid: Uuid) -> Self {\n        Self {\n            progress: AdvancementProgressMap::default(),\n            path: manager.advancement_path.join(format!(\"{uuid}.json\")),\n            manager,\n            player: Weak::new(),\n            is_first_packet: true,\n            roots_to_update: HashSet::default(),\n            visible: HashSet::default(),\n            progress_changed: HashSet::default(),","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin/src/entity/player/advancement.rs#L227-L263","documentation":"PacketDecodeError::TooLong is raised when the length prefix read from an incoming Minecraft protocol packet exceeds the maximum allowed packet size. The library enforces this limit to prevent malicious or corrupted clients from causing huge allocations or memory exhaustion. It is thrown during packet decoding before any payload is read.","triggerScenarios":"Calling the packet decode/read path on a connection whose length VarInt decodes to a value above the configured maximum packet length; feeding a byte stream with a corrupted or hostile length prefix.","commonSituations":"Malicious clients or bots sending oversized length fields; a desynchronized stream where a payload byte is misread as a length VarInt; mismatched compression settings between client and server shifting the framing.","solutions":["Verify the length prefix on the wire matches the actual packet size (check for stream desynchronization).","Ensure compression settings (threshold, enabled/disabled) match between client and server.","Log the offending length value and drop/ban clients that repeatedly send oversized packets.","If the limit is legitimately too small for your packets, raise the maximum length in the protocol configuration."],"exampleFix":"// before\nlet len = reader.read_var_int().await?; // no upper-bound check, decodes into TooLong later\n// after\nlet len = reader.read_var_int().await?;\nif len > MAX_PACKET_SIZE {\n    return Err(PacketDecodeError::TooLong);\n}","handlingStrategy":"validation","validationCode":"fn validate_packet_len(len: i32, max: i32) -> Result<(), PacketDecodeError> {\n    if len <= 0 || len > max { return Err(PacketDecodeError::TooLong); }\n    Ok(())\n}","typeGuard":"fn is_valid_packet_len(len: i32, max: i32) -> bool {\n    len > 0 && len <= max\n}","tryCatchPattern":"match decode_packet(stream).await {\n    Err(PacketDecodeError::TooLong) => { warn!(\"oversized packet from peer; dropping connection\"); drop(stream); }\n    Err(e) => warn!(\"decode error: {e}\"),\n    Ok(p) => handle(p),\n}","preventionTips":["Keep client and server compression/framing configuration in sync.","Enforce the maximum length check as early as possible in the read path.","Monitor and rate-limit peers that send oversized length prefixes.","Never trust a length field without validating it against buffer size and configured limits."],"tags":["protocol","packet-decoding","limit-exceeded","network"],"backgroundTag":"payload-too-large","analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}