{"record":{"id":"2d662e211e72f191","repo":"Pumpkin-MC/Pumpkin","slug":"compression-error-0","errorCode":null,"errorMessage":"Compression error {0}","messagePattern":"Compression error (.+?)","errorType":"error_code","errorClass":"ChunkReadingError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin-world/src/chunk/mod.rs","lineNumber":36,"sourceCode":"pub mod format;\npub mod io;\npub mod palette;\n\n// TODO\npub const CHUNK_WIDTH: usize = BlockPalette::SIZE;\npub const CHUNK_AREA: usize = CHUNK_WIDTH * CHUNK_WIDTH;\npub const BIOME_VOLUME: usize = BiomePalette::VOLUME;\npub const SUBCHUNK_VOLUME: usize = CHUNK_AREA * CHUNK_WIDTH;\n\n#[derive(Error, Debug)]\npub enum ChunkReadingError {\n    #[error(\"Io error: {0}\")]\n    IoError(std::io::Error),\n    #[error(\"Invalid header\")]\n    InvalidHeader,\n    #[error(\"Region is invalid\")]\n    RegionIsInvalid,\n    #[error(\"Compression error {0}\")]\n    Compression(CompressionError),\n    #[error(\"Tried to read chunk which does not exist\")]\n    ChunkNotExist,\n    #[error(\"Failed to parse chunk from bytes: {0}\")]\n    ParsingError(ChunkParsingError),\n}\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)]","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-world/src/chunk/mod.rs#L18-L54","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Regenerate or restore the affected chunk/region file","Check which compression scheme the world format expects","Log the compression error with the chunk coordinates"],"exampleFix":"// before\nlet data = reader.read_chunk(pos)?;\n// after\nlet data = reader.read_chunk(pos).map_err(|e| {\n    if let ChunkReadingError::Compression(c) = &e {\n        log::warn!(\"decompression failed: {c}\");\n    }\n    e\n})?;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_compression_failure(e: &ChunkReadingError) -> Option<&CompressionError> {\n    if let ChunkReadingError::Compression(c) = e { Some(c) } else { None }\n}","tryCatchPattern":"match reader.read_chunk(pos) {\n    Err(ChunkReadingError::Compression(c)) => log::warn!(\"decompress failed: {c}\"),\n    other => other?,\n}","preventionTips":["Verify world files after transfer (checksums).","Keep world-format versions in sync between tools and the server.","Handle failures per-chunk to isolate corruption."],"tags":["compression","minecraft","region-file","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"}