{"record":{"id":"d342d2a638b8346f","repo":"Pumpkin-MC/Pumpkin","slug":"failed-to-parse-chunk-from-bytes-0","errorCode":null,"errorMessage":"Failed to parse chunk from bytes: {0}","messagePattern":"Failed to parse chunk from bytes: (.+?)","errorType":"error_code","errorClass":"ChunkReadingError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin-world/src/chunk/mod.rs","lineNumber":40,"sourceCode":"// 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)]\npub enum CompressionError {\n    #[error(\"Compression scheme not recognised\")]\n    UnknownCompression,\n    #[error(\"Error while working with zlib compression: {0}\")]","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-world/src/chunk/mod.rs#L22-L58","documentation":"ChunkReadingError variant fired when the decompressed chunk bytes cannot be deserialized into a Chunk, wrapping ChunkParsingError — valid compression but invalid or incompatible chunk data (corrupt or wrong format version).","triggerScenarios":"Decompressing a chunk payload whose NBT structure is malformed, from an incompatible Minecraft data version, or produced by a tool that wrote non-standard chunk data.","commonSituations":"Downgrading a world to an older Minecraft version, region files modified by editors, modded worlds read by vanilla-format parsers.","solutions":["Restore the chunk from backup or regenerate it","Check the world format version matches the server's parser","Log the parse error with chunk coordinates"],"exampleFix":"// before\nlet chunk = reader.read_chunk(pos)?;\n// after\nmatch reader.read_chunk(pos) {\n    Ok(c) => Ok(c),\n    Err(ChunkReadingError::ParsingError(p)) => { log::error!(\"bad chunk data: {p}\"); generate_chunk(pos) }\n    Err(e) => Err(e),\n};","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_parse_failure(e: &ChunkReadingError) -> Option<&ChunkParsingError> {\n    if let ChunkReadingError::ParsingError(p) = e { Some(p) } else { None }\n}","tryCatchPattern":"match reader.read_chunk(pos) {\n    Err(ChunkReadingError::ParsingError(p)) => { log::error!(\"bad chunk: {p}\"); regenerate(pos) }\n    other => other?,\n}","preventionTips":["Run Minecraft data converters when changing game versions.","Avoid mixing modded and vanilla world formats.","Validate NBT output of any third-party world editor."],"tags":["minecraft","nbt","parsing","deserialization"],"backgroundTag":"json-unmarshal-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"}