Pumpkin-MC/Pumpkin · warning · ChunkReadingError

Tried to read chunk which does not exist

Error message

Tried to read chunk which does not exist

What it means

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.

Solutions

  1. Generate the chunk on demand instead of failing
  2. Check chunk coordinates against the world's saved range
  3. Log the miss at trace level

Example fix

// before
let chunk = reader.read_chunk(pos).unwrap();
// after
let chunk = match reader.read_chunk(pos) {
    Ok(c) => c,
    Err(ChunkReadingError::ChunkNotExist) => generate_chunk(pos),
    Err(e) => return Err(e),
};
Defensive patterns

Strategy: fallback

Validate before calling

if !reader.chunk_exists(pos) {
    let chunk = generate_chunk(pos);
}

Try / catch

match reader.read_chunk(pos) {
    Err(ChunkReadingError::ChunkNotExist) => generate_chunk(pos),
    other => other?,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09). Data as JSON: /api/errors/23773a0f0193f533. Report an issue: GitHub.

Appendix: source

Thrown at crates/pumpkin-world/src/chunk/mod.rs:38

pub mod palette;

// TODO
pub const CHUNK_WIDTH: usize = BlockPalette::SIZE;
pub const CHUNK_AREA: usize = CHUNK_WIDTH * CHUNK_WIDTH;
pub const BIOME_VOLUME: usize = BiomePalette::VOLUME;
pub const SUBCHUNK_VOLUME: usize = CHUNK_AREA * CHUNK_WIDTH;

#[derive(Error, Debug)]
pub enum ChunkReadingError {
    #[error("Io error: {0}")]
    IoError(std::io::Error),
    #[error("Invalid header")]
    InvalidHeader,
    #[error("Region is invalid")]
    RegionIsInvalid,
    #[error("Compression error {0}")]
    Compression(CompressionError),
    #[error("Tried to read chunk which does not exist")]
    ChunkNotExist,
    #[error("Failed to parse chunk from bytes: {0}")]
    ParsingError(ChunkParsingError),
}

#[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")]

View on GitHub (pinned to 8d4639e25a)