Pumpkin-MC/Pumpkin · error · PlayerDataError
NBT error
Error message
NBT error: {0} What it means
Variant `Nbt` of `PlayerDataError` in pumpkin-world, carrying a `String` description. The library throws it when player data NBT parsing or writing fails — the stored `.dat` file is not valid NBT or contains unexpected fields when reading player state.
Solutions
- Read the String payload for the specific NBT failure and inspect the .dat file
- Restore the player's .dat from backup or delete it to reset the player's data
- Verify the world's data version matches the running server
Defensive patterns
Strategy: try-catch
Type guard
matches!(err, PlayerDataError::Nbt(_))
Try / catch
match storage.load_player_data(uuid) {
Err(PlayerDataError::Nbt(msg)) => { warn!("corrupt playerdata for {uuid}: {msg}; resetting"); storage.reset(uuid)?; }
other => other?,
} Prevention
- Keep periodic backups of the playerdata directory
- Do not copy .dat files between servers of different data versions
- Never hand-edit player .dat files without validating NBT afterwards
When it happens
Trigger: Deserializing a player's `<uuid>.dat` file whose NBT structure is invalid, truncated, or written by an incompatible version.
Common situations: Corrupted playerdata from a server crash, playerdata copied between servers with different data versions, manually edited .dat files.
Understand the failure class
Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.
Related errors
- Deserialization error
- Error deserializing chunk
- Failed reading chunk status
- Failed to decode varint - value too large
- Failed to decode varlong - value too large
AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09).
Data as JSON: /api/errors/f3665d427208fc78.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin-world/src/data/player_data.rs:23
use tracing::{debug, error};
use uuid::Uuid;
/// Manages the storage and retrieval of player data from disk and memory cache.
///
/// This struct provides functions to load and save player data to/from NBT files,
/// with a memory cache to handle player disconnections temporarily.
pub struct PlayerDataStorage {
/// Path to the directory where player data is stored
data_path: PathBuf,
/// Whether player data saving is enabled
save_enabled: bool,
}
#[derive(Debug, thiserror::Error)]
pub enum PlayerDataError {
#[error("IO error: {0}")]
Io(#[from] io::Error),
#[error("NBT error: {0}")]
Nbt(String),
}
impl PlayerDataStorage {
/// Creates a new `PlayerDataStorage` with the specified data path and cache expiration time.
pub fn new(data_path: impl Into<PathBuf>, enabled: bool) -> Self {
let path = data_path.into();
if !path.exists()
&& let Err(e) = create_dir_all(&path)
{
error!(
"Failed to create player data directory at {}: {e}",
path.display()
);
}
Self {
data_path: path,View on GitHub (pinned to 8d4639e25a)