Pumpkin-MC/Pumpkin · error · ChunkReadingError

Io error

Error message

Io error: {0}

What it means

`ChunkReadingError::IoError` wraps a std::io::Error raised while reading chunk/region files from disk (defined via thiserror in pumpkin-world's chunk module). It surfaces low-level I/O failures — missing files, permission problems, or device errors — during chunk deserialization.

Solutions

  1. Check the world/region file exists at the expected path (ls the region directory)
  2. Fix filesystem permissions on the world directory
  3. Check disk space and dmesg/SMART for hardware I/O errors
  4. Recover the chunk/world from a backup if files are corrupted
  5. Match on ChunkReadingError::IoError to surface the inner std::io::Error for diagnosis

Example fix

// before
let chunk = ChunkReader::read(...)?;
// after
match ChunkReader::read(...) {
    Ok(c) => c,
    Err(ChunkReadingError::IoError(e)) => {
        log::error!("chunk io failure: {e}");
        regenerate_or_skip_chunk();
    }
    Err(e) => return Err(e.into()),
}
Defensive patterns

Strategy: try-catch

Validate before calling

let path = region_file_path(coords);
if !path.exists() {
    return Err(WorldError::RegionMissing(path));
}

Try / catch

match chunk::read(&path) {
    Ok(c) => c,
    Err(ChunkReadingError::IoError(e)) => {
        log::error!("chunk io: {e}");
        skip_or_regen_chunk();
    }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Any I/O operation during region/chunk file reading that returns std::io::Error — e.g. opening the region file fails, read_exact hits EOF mid-header, or seek fails.

Common situations: Missing or deleted region file in the world directory; wrong permissions on the world folder; disk full or I/O errors; corrupted world directory structure.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

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

use std::sync::RwLock;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::AtomicU64;
use thiserror::Error;

pub mod format;
pub mod io;
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}")]

View on GitHub (pinned to 8d4639e25a)