{"record":{"id":"23773a0f0193f533","repo":"Pumpkin-MC/Pumpkin","slug":"tried-to-read-chunk-which-does-not-exist","errorCode":null,"errorMessage":"Tried to read chunk which does not exist","messagePattern":"Tried to read chunk which does not exist","errorType":"error_code","errorClass":"ChunkReadingError","httpStatus":null,"severity":"warning","filePath":"crates/pumpkin-world/src/chunk/mod.rs","lineNumber":38,"sourceCode":"pub 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)]\npub enum CompressionError {\n    #[error(\"Compression scheme not recognised\")]","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-world/src/chunk/mod.rs#L20-L56","documentation":"ChunkReadingError sentinel from the region/anvil chunk reader: a lookup was requested for a chunk whose data is absent — the region file entry for those chunk coordinates is empty (never generated) or the chunk was never written. It is a 'not found' style guard, not corruption; the offending input is the requested chunk coordinates.","triggerScenarios":"Requesting a chunk that has never been generated/saved, e.g. calling a chunk-read API with coordinates whose sector offset in the region location table is zero.","commonSituations":"Exploring near ungenerated world borders, reading chunks from a freshly created world, loading a save from a different seed where the chunk was never written.","solutions":["Generate the chunk on demand instead of failing","Check chunk coordinates against the world's saved range","Log the miss at trace level"],"exampleFix":"// before\nlet chunk = reader.read_chunk(pos).unwrap();\n// after\nlet chunk = match reader.read_chunk(pos) {\n    Ok(c) => c,\n    Err(ChunkReadingError::ChunkNotExist) => generate_chunk(pos),\n    Err(e) => return Err(e),\n};","handlingStrategy":"fallback","validationCode":"if !reader.chunk_exists(pos) {\n    let chunk = generate_chunk(pos);\n}","typeGuard":null,"tryCatchPattern":"match reader.read_chunk(pos) {\n    Err(ChunkReadingError::ChunkNotExist) => generate_chunk(pos),\n    other => other?,\n}","preventionTips":["Treat missing chunks as a normal case and generate on demand.","Confirm region-file mapping for chunk coordinates.","Pre-generate world areas before players reach them."],"tags":["minecraft","chunk","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}