Pumpkin-MC/Pumpkin · error · CompressionError
Error while working with Gzip compression
Error message
Error while working with Gzip compression: {0} What it means
CompressionError variant from chunk (de)compression: the Gzip encoder/decoder returned an io error while handling the chunk payload. The offending input is the Gzip-compressed chunk data read from (or being written to) the region file; corruption or truncation of that stream surfaces here wrapped in the io error.
Solutions
- Regenerate the affected chunk data
- Verify the gzip stream header and integrity
- Log the underlying io error
Example fix
// before
let raw = gzip_decode(payload).unwrap();
// after
let raw = gzip_decode(payload)
.map_err(|e| { log::error!("gzip failure on chunk data: {e}"); e })?; Defensive patterns
Strategy: try-catch
Type guard
fn is_gzip_failure(e: &CompressionError) -> Option<&std::io::Error> {
if let CompressionError::GZipError(e) = e { Some(e) } else { None }
} Try / catch
match decompress_chunk(payload, Scheme::Gzip) {
Err(CompressionError::GZipError(e)) => { log::error!("gzip: {e}"); restore_from_backup() }
other => other?,
} Prevention
- Validate gzip integrity of legacy region files before loading.
- Convert old gzip regions to zlib for consistency.
- Keep backups of legacy worlds before any conversion.
When it happens
Trigger: Reading a chunk stored with gzip compression whose payload is corrupt, truncated, or not valid gzip; or a gzip compression failure during save.
Common situations: Old region files (gzip was used in early formats) that are damaged, worlds transferred incompletely, editors writing malformed gzip blobs.
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
- Compression error
- Error while working with zlib compression
- NBT reading was cut short
- Region is invalid
- Compression scheme not recognised
AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09).
Data as JSON: /api/errors/a16537832a73b0c2.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin-world/src/chunk/mod.rs:60
}
#[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,
pub block_ticks: ChunkTickScheduler<&'static Block>,
pub fluid_ticks: ChunkTickScheduler<&'static Fluid>,
pub pending_block_entities: std::sync::Mutex<FxHashMap<BlockPos, NbtCompound>>,
pub light_engine: std::sync::Mutex<ChunkLight>,View on GitHub (pinned to 8d4639e25a)