{"record":{"id":"0160e0b3797d2df8","repo":"Pumpkin-MC/Pumpkin","slug":"deserialization-error-0","errorCode":null,"errorMessage":"Deserialization error: {0}","messagePattern":"Deserialization error: (.+?)","errorType":"error_code","errorClass":"WorldInfoError","httpStatus":null,"severity":"critical","filePath":"crates/pumpkin-world/src/world_info/mod.rs","lineNumber":367,"sourceCode":"        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 {\n    fn from(value: std::io::Error) -> Self {\n        match value.kind() {\n            std::io::ErrorKind::NotFound => Self::InfoNotFound,\n            value => Self::IoError(value),","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-world/src/world_info/mod.rs#L349-L385","documentation":"WorldInfoError::DeserializationError(String) is returned when world info was found but its NBT contents could not be converted into the expected structures. The String carries the detail, e.g. 'Missing DataVersion' or 'Missing version' when level.dat lacks those tags (anvil.rs:40-67). It covers structural NBT mismatches rather than io or version-range failures.","triggerScenarios":"check_data_version or check_level_version find no 'DataVersion'/'version' int tag in the Data compound; NBT parsing of level.dat fails or a required compound/tag is absent while converting to LevelData; the seed lookup fails to parse stored settings.","commonSituations":"Corrupt or truncated level.dat (e.g. crash mid-save, failed gzip); extremely old worlds written before DataVersion existed; third-party tools rewriting level.dat with a different schema.","solutions":["Check the error's String detail and open level.dat with an NBT viewer to see which tag is missing or malformed.","Restore level.dat from level.dat_old or a backup.","If the world is genuinely ancient, upgrade it with an official Minecraft client first, then load it in Pumpkin.","Regenerate the world if no backup exists and the file is unreadable garbage."],"exampleFix":"// before: trusting any level.dat\nlet level = reader.read_world_info(&path)?;\n// after: fall back to the backup on deserialization failure\nlet level = match reader.read_world_info(&path) {\n    Err(WorldInfoError::DeserializationError(msg)) => {\n        warn(\"level.dat corrupt: {msg}; trying backup\");\n        reader.read_world_info(&path.with_file_name(\"level.dat_old\"))?\n    }\n    other => other?,\n};","handlingStrategy":"try-catch","validationCode":"fn level_dat_parses(path: &Path) -> bool {\n    std::fs::File::open(path).ok()\n        .and_then(|f| pumpkin_nbt::from_reader(gz_decode(f)).ok())\n        .is_some()\n}","typeGuard":"fn has_required_tags(root: &NbtCompound) -> bool {\n    root.get_compound(\"Data\")\n        .map(|d| d.get_int(\"DataVersion\").is_some() && d.get_int(\"version\").is_some())\n        .unwrap_or(false)\n}","tryCatchPattern":"match reader.read_world_info(&path) {\n    Err(WorldInfoError::DeserializationError(msg)) => {\n        warn!(\"level.dat unreadable ({msg}); falling back to level.dat_old\");\n        reader.read_world_info(&path.with_file_name(\"level.dat_old\"))?;\n    }\n    other => { other?; }\n}","preventionTips":["Keep level.dat_old as a fallback; never delete it","Gracefully shut down the server to avoid truncated level.dat writes","Migrate very old worlds through a vanilla client before loading","After third-party tools touch level.dat, verify it still has DataVersion and version"],"tags":["nbt","deserialization","world-info","corruption"],"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-15T23:17:13.987Z"}