{"record":{"id":"a16537832a73b0c2","repo":"Pumpkin-MC/Pumpkin","slug":"error-while-working-with-gzip-compression-0","errorCode":null,"errorMessage":"Error while working with Gzip compression: {0}","messagePattern":"Error while working with Gzip compression: (.+?)","errorType":"error_code","errorClass":"CompressionError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin-world/src/chunk/mod.rs","lineNumber":60,"sourceCode":"}\n\n#[derive(Error, Debug)]\npub enum ChunkWritingError {\n    #[error(\"Io error: {0}\")]\n    IoError(std::io::Error),\n    #[error(\"Compression error {0}\")]\n    Compression(CompressionError),\n    #[error(\"Chunk serializing error: {0}\")]\n    ChunkSerializingError(String),\n}\n\n#[derive(Error, Debug)]\npub enum CompressionError {\n    #[error(\"Compression scheme not recognised\")]\n    UnknownCompression,\n    #[error(\"Error while working with zlib compression: {0}\")]\n    ZlibError(std::io::Error),\n    #[error(\"Error while working with Gzip compression: {0}\")]\n    GZipError(std::io::Error),\n    #[error(\"Error while working with LZ4 compression: {0}\")]\n    LZ4Error(std::io::Error),\n    #[error(\"Error while working with zstd compression: {0}\")]\n    ZstdError(std::io::Error),\n}\n\n// Clone here cause we want to clone a snapshot of the chunk so we don't block writing for too long\npub struct ChunkData {\n    pub section: ChunkSections,\n    /// See `https://minecraft.wiki/w/Heightmap` for more info\n    pub heightmap: std::sync::Mutex<ChunkHeightmaps>,\n    pub x: i32,\n    pub z: i32,\n    pub block_ticks: ChunkTickScheduler<&'static Block>,\n    pub fluid_ticks: ChunkTickScheduler<&'static Fluid>,\n    pub pending_block_entities: std::sync::Mutex<FxHashMap<BlockPos, NbtCompound>>,\n    pub light_engine: std::sync::Mutex<ChunkLight>,","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-world/src/chunk/mod.rs#L42-L78","documentation":"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.","triggerScenarios":"Reading a chunk stored with gzip compression whose payload is corrupt, truncated, or not valid gzip; or a gzip compression failure during save.","commonSituations":"Old region files (gzip was used in early formats) that are damaged, worlds transferred incompletely, editors writing malformed gzip blobs.","solutions":["Regenerate the affected chunk data","Verify the gzip stream header and integrity","Log the underlying io error"],"exampleFix":"// before\nlet raw = gzip_decode(payload).unwrap();\n// after\nlet raw = gzip_decode(payload)\n    .map_err(|e| { log::error!(\"gzip failure on chunk data: {e}\"); e })?;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_gzip_failure(e: &CompressionError) -> Option<&std::io::Error> {\n    if let CompressionError::GZipError(e) = e { Some(e) } else { None }\n}","tryCatchPattern":"match decompress_chunk(payload, Scheme::Gzip) {\n    Err(CompressionError::GZipError(e)) => { log::error!(\"gzip: {e}\"); restore_from_backup() }\n    other => other?,\n}","preventionTips":["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."],"tags":["compression","gzip","minecraft","io"],"backgroundTag":"file-read-failed","analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}