Pumpkin-MC/Pumpkin · error · CompressionError

Compression scheme not recognised

Error message

Compression scheme not recognised

What it means

CompressionError::UnknownCompression is raised when chunk data uses a compression scheme byte that the library does not recognize. Anvil supports a fixed set (gzip, zlib, etc.); anything outside the known ids is rejected.

Solutions

  1. Identify the scheme id in the file and confirm it is one the library supports (enable the matching crate feature, e.g. lz4 or zstd).
  2. Upgrade the library/version to one supporting the scheme.
  3. Recompress or convert the world with a tool to a supported scheme like zlib.

Example fix

// before: assume zlib always
let data = decompress(bytes, Scheme::Zlib)?;
// after
let scheme = Scheme::from_id(id).ok_or(CompressionError::UnknownCompression)?;
let data = decompress(bytes, scheme)?;
Defensive patterns

Strategy: validation

Validate before calling

let id = payload.scheme_byte();
if !SUPPORTED_SCHEMES.contains(&id) {
    return Err(CompressionError::UnknownCompression);
}

Type guard

fn is_supported_scheme(id: u8) -> bool { matches!(id, 1..=4) }

Try / catch

match read_chunk_data(bytes) {
    Err(CompressionError::UnknownCompression) => convert_world_or_upgrade(),
    other => other?,
}

Prevention

When it happens

Trigger: Reading a chunk whose region-file compression id is unknown — e.g. data written by a newer Minecraft version using a scheme this build does not support, or a corrupt scheme byte.

Common situations: Worlds saved by newer game versions or mod loaders, region files edited by third-party tools, corrupted header bytes.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

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

    #[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)]
pub enum CompressionError {
    #[error("Compression scheme not recognised")]
    UnknownCompression,
    #[error("Error while working with zlib compression: {0}")]
    ZlibError(std::io::Error),
    #[error("Error while working with Gzip compression: {0}")]
    GZipError(std::io::Error),
    #[error("Error while working with LZ4 compression: {0}")]
    LZ4Error(std::io::Error),
    #[error("Error while working with zstd compression: {0}")]
    ZstdError(std::io::Error),
}

// Clone here cause we want to clone a snapshot of the chunk so we don't block writing for too long
pub struct ChunkData {
    pub section: ChunkSections,
    /// See `https://minecraft.wiki/w/Heightmap` for more info
    pub heightmap: std::sync::Mutex<ChunkHeightmaps>,
    pub x: i32,
    pub z: i32,

View on GitHub (pinned to 8d4639e25a)