Pumpkin-MC/Pumpkin · error · ChunkReadingError

Compression error

Error message

Compression error {0}

What it means

ChunkReadingError::Compression; the region file's chunk data uses a compression scheme that itself failed (wrapped CompressionError), so the chunk bytes could not be decompressed during region reading.

Solutions

  1. Regenerate or restore the affected chunk/region file
  2. Check which compression scheme the world format expects
  3. Log the compression error with the chunk coordinates

Example fix

// before
let data = reader.read_chunk(pos)?;
// after
let data = reader.read_chunk(pos).map_err(|e| {
    if let ChunkReadingError::Compression(c) = &e {
        log::warn!("decompression failed: {c}");
    }
    e
})?;
Defensive patterns

Strategy: try-catch

Type guard

fn is_compression_failure(e: &ChunkReadingError) -> Option<&CompressionError> {
    if let ChunkReadingError::Compression(c) = e { Some(c) } else { None }
}

Try / catch

match reader.read_chunk(pos) {
    Err(ChunkReadingError::Compression(c)) => log::warn!("decompress failed: {c}"),
    other => other?,
}

Prevention

When it happens

Trigger: Calling chunk read APIs when the stored chunk payload was compressed with a scheme the reader fails at, or the compressed payload is truncated/corrupt.

Common situations: Region files edited by third-party tools, interrupted world writes leaving partial compressed blobs, chunk data compressed with zlib levels/algorithms differing from what is expected.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

Thrown at crates/pumpkin-world/src/chunk/mod.rs:36

pub mod format;
pub mod io;
pub mod palette;

// TODO
pub const CHUNK_WIDTH: usize = BlockPalette::SIZE;
pub const CHUNK_AREA: usize = CHUNK_WIDTH * CHUNK_WIDTH;
pub const BIOME_VOLUME: usize = BiomePalette::VOLUME;
pub const SUBCHUNK_VOLUME: usize = CHUNK_AREA * CHUNK_WIDTH;

#[derive(Error, Debug)]
pub enum ChunkReadingError {
    #[error("Io error: {0}")]
    IoError(std::io::Error),
    #[error("Invalid header")]
    InvalidHeader,
    #[error("Region is invalid")]
    RegionIsInvalid,
    #[error("Compression error {0}")]
    Compression(CompressionError),
    #[error("Tried to read chunk which does not exist")]
    ChunkNotExist,
    #[error("Failed to parse chunk from bytes: {0}")]
    ParsingError(ChunkParsingError),
}

#[derive(Error, Debug)]
pub enum ChunkWritingError {
    #[error("Io error: {0}")]
    IoError(std::io::Error),
    #[error("Compression error {0}")]
    Compression(CompressionError),
    #[error("Chunk serializing error: {0}")]
    ChunkSerializingError(String),
}

#[derive(Error, Debug)]

View on GitHub (pinned to 8d4639e25a)