{"record":{"id":"8c1e130cf86d8fd5","repo":"Pumpkin-MC/Pumpkin","slug":"io-error-0-8c1e13","errorCode":null,"errorMessage":"Io error: {0}","messagePattern":"Io error: (.+?)","errorType":"error_code","errorClass":"WorldInfoError","httpStatus":null,"severity":"critical","filePath":"crates/pumpkin-world/src/world_info/mod.rs","lineNumber":363,"sourceCode":"        seed: Seed,\n        generator: &crate::generation::generator::VanillaGenerator,\n    ) -> Self {\n        let mut data = Self::default(seed);\n        let spawn_pos = generator.find_spawn_position();\n        data.spawn_x = spawn_pos.0.x;\n        data.spawn_z = spawn_pos.0.z;\n        data\n    }\n\n    pub const fn set_pos(&mut self, x: i32, z: i32) {\n        self.spawn_x = x;\n        self.spawn_z = z;\n    }\n}\n\n#[derive(Error, Debug)]\npub enum WorldInfoError {\n    #[error(\"Io error: {0}\")]\n    IoError(std::io::ErrorKind),\n    #[error(\"Info not found!\")]\n    InfoNotFound,\n    #[error(\"Deserialization error: {0}\")]\n    DeserializationError(String),\n    #[error(\n        \"No world seed found: neither level.dat nor data/minecraft/world_gen_settings.dat contains one\"\n    )]\n    MissingWorldSeed,\n    #[error(\"Serialization error: {0}\")]\n    SerializationError(String),\n    #[error(\"Unsupported world data version: {0}\")]\n    UnsupportedDataVersion(i32),\n    #[error(\"Unsupported world level version: {0}\")]\n    UnsupportedLevelVersion(i32),\n}\n\nimpl From<std::io::Error> for WorldInfoError {","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-world/src/world_info/mod.rs#L345-L381","documentation":"WorldInfoError::IoError(std::io::ErrorKind) is returned when reading or writing world info (level.dat / level.dat_old) fails at the filesystem level. The io::Error is converted into this variant via From<std::io::Error>, keeping only the ErrorKind. It wraps low-level OS failures such as file-not-found, permission-denied, or interrupted reads.","triggerScenarios":"AnvilLevelInfo's WorldInfoReader::read_world_info or WorldInfoWriter::write_world_info opens/reads/writes the level folder's level.dat (or its backup) and the underlying std::io operation fails; the From impl at world_info/mod.rs:381 maps it to IoError.","commonSituations":"level.dat missing from a partially-copied world folder; read-only server directory or insufficient permissions; disk full during a level.dat save; file locked by another process (e.g. backup tool) on Windows.","solutions":["Check that the level folder contains a readable level.dat (and level.dat_old) with correct permissions.","Run the server under a user with read/write access to the world directory and ensure the disk has free space.","Match on the returned ErrorKind (NotFound, PermissionDenied, etc.) to apply the appropriate fix or retry.","Restore level.dat from level.dat_old or a backup if the file is corrupt or zero-length."],"exampleFix":"// before: ignoring the kind and crashing on any io failure\nlet level = reader.read_world_info(&path)?;\n// after: handle known io kinds gracefully\nmatch reader.read_world_info(&path) {\n    Err(WorldInfoError::IoError(std::io::ErrorKind::NotFound)) => init_fresh_world(&path),\n    other => other?,\n}","handlingStrategy":"try-catch","validationCode":"fn level_dat_readable(level_folder: &Path) -> std::io::Result<()> {\n    let f = std::fs::File::open(level_folder.join(\"level.dat\"))?;\n    f.metadata()?.permissions().readonly();\n    Ok(())\n}","typeGuard":"fn world_info_present(level_folder: &Path) -> bool {\n    level_folder.join(\"level.dat\").is_file()\n}","tryCatchPattern":"match reader.read_world_info(&path) {\n    Err(WorldInfoError::IoError(kind)) => match kind {\n        std::io::ErrorKind::NotFound => init_new_world(&path),\n        std::io::ErrorKind::PermissionDenied => eprintln!(\"fix permissions on {}\", path.display()),\n        _ => eprintln!(\"io failure reading world info: {kind:?}\"),\n    },\n    other => { other?; }\n}","preventionTips":["Ensure the server process user owns or can read/write the world directory","Check disk free space before saves","Back up level.dat before running external tools against it","On Windows, avoid concurrent access by backup/AV software"],"tags":["io","filesystem","world-info","level-dat"],"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"}