StackableItems

StackableItems

99k Downloads

[Bug] Failures to save player data

hmlendea opened this issue ยท 0 comments

commented

Hello,

Since 1.21 I've been getting a lot of errors such as this:

[11:26:12] [Server thread/WARN]: Failed to save player data for Hori
net.minecraft.ReportedException: Saving entity NBT
	at net.minecraft.world.entity.Entity.saveWithoutId(Entity.java:2594) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.world.entity.Entity.saveWithoutId(Entity.java:2428) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.world.level.storage.PlayerDataStorage.save(PlayerDataStorage.java:40) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.server.players.PlayerList.save(PlayerList.java:574) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.server.players.PlayerList.lambda$saveAll$3(PlayerList.java:1237) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at io.papermc.paper.util.MCUtil.ensureMain(MCUtil.java:128) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.server.players.PlayerList.saveAll(PlayerList.java:1230) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.server.players.PlayerList.saveAll(PlayerList.java:1226) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.server.MinecraftServer.saveEverything(MinecraftServer.java:1000) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.server.commands.SaveAllCommand.saveAll(SaveAllCommand.java:26) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.server.commands.SaveAllCommand.lambda$register$1(SaveAllCommand.java:18) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73) ~[brigadier-1.2.9.jar:?]
	at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:30) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:13) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.commands.execution.UnboundEntryAction.lambda$bind$0(UnboundEntryAction.java:8) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.commands.execution.CommandQueueEntry.execute(CommandQueueEntry.java:5) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.commands.execution.ExecutionContext.runCommandQueue(ExecutionContext.java:103) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.commands.Commands.executeCommandInContext(Commands.java:451) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.commands.Commands.performCommand(Commands.java:358) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.commands.Commands.performCommand(Commands.java:345) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.commands.Commands.performPrefixedCommand(Commands.java:335) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at org.bukkit.craftbukkit.command.VanillaCommandWrapper.execute(VanillaCommandWrapper.java:55) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:178) ~[paper-mojangapi-1.21-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:1014) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at org.bukkit.craftbukkit.CraftServer.dispatchServerCommand(CraftServer.java:999) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.server.dedicated.DedicatedServer.handleConsoleInputs(DedicatedServer.java:562) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:510) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1633) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1333) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:333) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at java.base/java.lang.Thread.run(Unknown Source) ~[?:?]
Caused by: java.lang.IllegalStateException: Value must be within range [1;99]: 126
	at com.mojang.serialization.DataResult$Error.getOrThrow(DataResult.java:287) ~[datafixerupper-8.0.16.jar:?]
	at com.mojang.serialization.DataResult.getOrThrow(DataResult.java:81) ~[datafixerupper-8.0.16.jar:?]
	at net.minecraft.world.item.ItemStack.save(ItemStack.java:616) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.world.entity.player.Inventory.save(Inventory.java:501) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.world.entity.player.Player.addAdditionalSaveData(Player.java:970) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.server.level.ServerPlayer.addAdditionalSaveData(ServerPlayer.java:613) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.world.entity.Entity.addAdditionalSaveData(Entity.java:2764) ~[purpur-1.21.jar:1.21-2275-82ccc76]
	at net.minecraft.world.entity.Entity.saveWithoutId(Entity.java:2537) ~[purpur-1.21.jar:1.21-2275-82ccc76]

By looking carefuly at that log, it can be seen that the problem is the stack size of items. I've confirmed this by reducing all stacks in my inventory to <=99 and the player save was successful. Adding back a stack of >=100 made the saving fail again.

I think you should hardcode the upper limit of the stack size that this plugin allows to 99. The current limit of 127 is outdated, as it does not work on 1.21 and causes serious issues (saving player data is pretty fundamental to a server).

I'm very sad about this situation, as I quite liked having 126 stacks, and if anything I'd have wanted them to be even larger, not smaller...
I've already configured my max stack sizes to 96 on my server, and I don't have this issue anymore, but I still think the upper limit should be changed in the plugin to avoid other people from encountering this problem and experience data loss (and possibly waste a lot of time until they figure out why).