Pumpkin-MC/Pumpkin · error

miss_count exceeds limit

Error message

miss_count exceeds limit

What it means

Thrown when decoding SClientCacheBlobStatus: the VarUInt miss_count read from the packet exceeds 4096. The library enforces this cap so a malicious count cannot force huge allocations or unbounded hash reads.

Solutions

  1. Check whether the client stream is aligned; an earlier misparse shifts the VarUInt boundary.
  2. Reduce the number of missed blobs the client reports if it genuinely exceeds 4096.
  3. Verify client/server chunk-blob cache protocol versions agree.
  4. Log and drop packets from peers that repeatedly send oversized counts.

Example fix

// client before
let miss = all_missing_blobs(); // unbounded
// after
let miss: Vec<_> = all_missing_blobs().into_iter().take(4096).collect();
Defensive patterns

Strategy: validation

Validate before calling

fn validate_miss_count(count: u32) -> Result<(), String> {
    if count > 4096 {
        return Err(format!("miss_count {count} exceeds 4096"));
    }
    Ok(())
}

Try / catch

match SClientCacheBlobStatus::read(reader) {
    Err(e) if e.to_string().contains("miss_count") => {
        log::warn!("invalid blob status packet: {e}; dropping client packet");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Triggered by SClientCacheBlobStatus::read when the first VarUInt (miss_count) is greater than 4096.

Common situations: Malicious clients flooding the server, stream desynchronization reading unrelated bytes as miss_count, a client bug writing an incorrect blob status.

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

Appendix: source

Thrown at crates/pumpkin-protocol/src/bedrock/server/client_cache_blob_status.rs:19

// Last verified for v2169

use std::io::{Error, Read};

use pumpkin_macros::packet;

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

#[packet(135)]
pub struct SClientCacheBlobStatus {
    pub miss_hashes: Vec<u64>,
    pub hit_hashes: Vec<u64>,
}

impl PacketRead for SClientCacheBlobStatus {
    fn read<R: Read>(reader: &mut R) -> Result<Self, Error> {
        let miss_count = VarUInt::read(reader)?.0 as usize;
        if miss_count > 4096 {
            return Err(Error::new(
                std::io::ErrorKind::InvalidData,
                "miss_count exceeds limit",
            ));
        }
        let mut miss_hashes = Vec::with_capacity(miss_count.min(256));
        for _ in 0..miss_count {
            miss_hashes.push(u64::read(reader)?);
        }

        let hit_count = VarUInt::read(reader)?.0 as usize;
        if hit_count > 4096 {
            return Err(Error::new(
                std::io::ErrorKind::InvalidData,
                "hit_count exceeds limit",
            ));
        }
        let mut hit_hashes = Vec::with_capacity(hit_count.min(256));
        for _ in 0..hit_count {

View on GitHub (pinned to 8d4639e25a)