Pumpkin-MC/Pumpkin · error
length exceeds
Error message
{name} length {len} exceeds {MAX_COLLECTION_LENGTH} What it means
A generic guard in inventory_transaction decoding: collection_length() reads a VarUInt length for a named collection (e.g. 'inventory actions', 'requests') and rejects values above MAX_COLLECTION_LENGTH (1024). The message interpolates the collection name, actual length, and limit.
Solutions
- Check for earlier field misalignment in the transaction packet; one bad read shifts all following lengths.
- Reduce transaction batch sizes on the client to at most 1024 entries.
- Verify client and server protocol versions for the inventory transaction layout.
- Inspect the raw packet to see which named collection is oversized and why.
Example fix
// client before: batch everything in one packet
let actions = gather_all_pending_actions();
// after: split into chunks
for chunk in gather_all_pending_actions().chunks(1024) {
send_transaction(chunk);
} Defensive patterns
Strategy: validation
Validate before calling
fn validate_collection_len(len: u32) -> Result<(), String> {
const MAX: u32 = 1024;
if len > MAX {
return Err(format!("collection length {len} exceeds {MAX}"));
}
Ok(())
} Try / catch
match InventoryTransactionPacket::read(buf) {
Err(e) if e.to_string().contains("exceeds 1024") => {
log::warn!("oversized collection in transaction packet: {e}; dropping");
}
other => other?,
} Prevention
- Chunk large transaction batches into packets of at most 1024 entries
- Check for desync earlier in the packet: one bad length read shifts all later ones
- Log the collection name from the message to locate the offending field
When it happens
Trigger: Triggered whenever any collection in InventoryTransactionPacket (actions, legacy set item slots, requests, etc.) declares a VarUInt length greater than 1024.
Common situations: Malicious or buggy clients sending huge counts, stream desync after a prior misparse, mods generating oversized transaction batches.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- missing inventory transaction type
- missing inventory action data
- Unknown inventory transaction type
- item string array length out of bounds
- miss_count exceeds limit
AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09).
Data as JSON: /api/errors/c5881803ed57d63c.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin-protocol/src/bedrock/server/inventory_transaction.rs:18
use std::io::{Error, ErrorKind, Read};
use pumpkin_macros::packet;
use pumpkin_util::math::position::BlockPos;
use crate::bedrock::network_item::NetworkItemDescriptor;
use crate::{
codec::{var_int::VarInt, var_uint::VarUInt, var_ulong::VarULong},
serial::PacketRead,
};
use pumpkin_util::math::vector3::Vector3;
const MAX_COLLECTION_LENGTH: u32 = 1024;
fn collection_length<R: Read>(reader: &mut R, name: &str) -> Result<usize, Error> {
let len = VarUInt::read(reader)?.0;
if len > MAX_COLLECTION_LENGTH {
return Err(Error::new(
ErrorKind::InvalidData,
format!("{name} length {len} exceeds {MAX_COLLECTION_LENGTH}"),
));
}
Ok(len as usize)
}
pub const WINDOW_ID_INVENTORY: i32 = 0;
pub const WINDOW_ID_OFF_HAND: i32 = 119;
pub const WINDOW_ID_ARMOUR: i32 = 120;
pub const WINDOW_ID_UI: i32 = 124;
#[derive(Debug, PartialEq, Eq)]
pub enum InventoryActionSource {
Container,
World,
Creative,
Todo,View on GitHub (pinned to 8d4639e25a)