Pumpkin-MC/Pumpkin · error

resource pack status is too large

Error message

resource pack status is too large

What it means

Thrown when decoding the Bedrock ResourcePackClientResponse packet: the VarUInt-encoded status, incremented by one to map onto the u8 status constants, overflows u8 or exceeds it. Any encoded_status >= 255 is invalid and signals a malformed packet.

Solutions

  1. Confirm client and server agree on the Bedrock protocol version
  2. Capture and inspect raw bytes of the offending packet
  3. Update the protocol crate if the client uses a newer status encoding
  4. Disconnect clients sending invalid status values
Defensive patterns

Strategy: validation

Validate before calling

let encoded = VarUInt::read(r)?.0;
let ok = encoded.checked_add(1).and_then(|v| u8::try_from(v).ok()).is_some();
if !ok { return Err(...); }

Try / catch

match ResourcePackClientResponse::read(reader) {
    Ok(resp) => handle(resp),
    Err(e) if e.kind() == std::io::ErrorKind::InvalidData => disconnect(peer, "invalid pack status"),
    Err(e) => Err(e.into()),
}

Prevention

When it happens

Trigger: ResourcePackClientResponse where the status VarUInt is >= 255 so checked_add(1) + u8::try_from fails.

Common situations: Protocol version mismatch causing the status field to be misread, corrupted network data, or crafted packets probing the pack-response handler.

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


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

Appendix: source

Thrown at crates/pumpkin-protocol/src/bedrock/server/resource_pack_client_response.rs:20

use crate::{codec::var_uint::VarUInt, serial::PacketRead};
use pumpkin_macros::packet;

#[packet(8)]
pub struct SResourcePackClientResponse {
    pub response: u8,
    pub download_size: u16,
    pub pack_ids: Vec<String>,
}

impl PacketRead for SResourcePackClientResponse {
    fn read<R: Read>(reader: &mut R) -> Result<Self, Error> {
        let encoded_status = VarUInt::read(reader)?.0;
        let response = encoded_status
            .checked_add(1)
            .and_then(|v| u8::try_from(v).ok())
            .ok_or_else(|| {
                Error::new(ErrorKind::InvalidData, "resource pack status is too large")
            })?;
        let _status_name = String::read(reader)?;

        let pack_ids = if response == Self::STATUS_SEND_PACKS {
            let count = VarUInt::read(reader)?.0;
            if count > 1024 {
                return Err(Error::new(
                    ErrorKind::InvalidData,
                    "too many resource pack identifiers",
                ));
            }
            (0..count)
                .map(|_| String::read(reader))
                .collect::<Result<Vec<_>, _>>()?
        } else {
            Vec::new()
        };
        let download_size = u16::try_from(pack_ids.len()).map_err(|_| {

View on GitHub (pinned to 8d4639e25a)