Pumpkin-MC/Pumpkin · error

too many resource pack identifiers

Error message

too many resource pack identifiers

What it means

Guard in SResourcePackClientResponse::read raising a generic InvalidData error when the packet declares more resource pack identifiers than allowed, protecting against oversized hostile client responses.

Solutions

  1. Reject the resource-pack response packet
  2. Keep the identifier count limit and reserve bounded capacity
  3. Log the violation at debug level
Defensive patterns

Strategy: validation

Validate before calling

let count = VarUInt::read(r)?.0;
if count > 1024 { return Err(...); }

Try / catch

if let Err(e) = resp.read(reader) {
    if e.kind() == std::io::ErrorKind::InvalidData { metrics.pack_limit_hits.inc(); disconnect(peer); }
}

Prevention

When it happens

Trigger: Client responds with pack ids where the VarUInt count field exceeds 1024.

Common situations: Buggy clients echoing oversized pack lists, modded clients, or protocol desync reading unrelated data as the count.

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/b1621ba7bc9a9402. Report an issue: GitHub.

Appendix: source

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

    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(|_| {
            Error::new(ErrorKind::InvalidData, "too many resource pack identifiers")
        })?;

        Ok(Self {
            response,
            download_size,
            pack_ids,

View on GitHub (pinned to 8d4639e25a)