Shopkeepers

Shopkeepers

2M Downloads

Failed to load the save file

rumickon opened this issue ยท 5 comments

commented

Preliminaries:

  • Shopkeepers version: v2.18.1-SNAPSHOT+ad5f2e7a
  • Paper version: git-Paper-222 (MC: 1.20.2) (Implementing API version 1.20.2-R0.1-SNAPSHOT) (Git: adb4fb4)

The issue:

Failed to load plugin when bee hive in save file. Save file is generated automatically.

[Shopkeepers] Failed to load the save file! Note: Server downgrades or manually editing the save file are not supported!
com.nisovin.shopkeepers.util.data.persistence.InvalidDataFormatException: Failed to load data as Bukkit config!
	at com.nisovin.shopkeepers.util.data.persistence.bukkit.BukkitConfigDataStore.loadFromString(BukkitConfigDataStore.java:63) ~[Shopkeepers-2.18.1-SNAPSHOT.jar:?]
	at com.nisovin.shopkeepers.util.data.persistence.DataStoreBase.load(DataStoreBase.java:58) ~[Shopkeepers-2.18.1-SNAPSHOT.jar:?]
	at com.nisovin.shopkeepers.storage.SKShopkeeperStorage.doReload(SKShopkeeperStorage.java:456) ~[Shopkeepers-2.18.1-SNAPSHOT.jar:?]
	at com.nisovin.shopkeepers.storage.SKShopkeeperStorage.reload(SKShopkeeperStorage.java:408) ~[Shopkeepers-2.18.1-SNAPSHOT.jar:?]
	at com.nisovin.shopkeepers.SKShopkeepersPlugin.onEnable(SKShopkeepersPlugin.java:409) ~[Shopkeepers-2.18.1-SNAPSHOT.jar:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189) ~[paper-1.20.2.jar:git-Paper-222]
	at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[paper-1.20.2.jar:git-Paper-222]
	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.craftbukkit.v1_20_R2.CraftServer.enablePlugin(CraftServer.java:644) ~[paper-1.20.2.jar:git-Paper-222]
	at org.bukkit.craftbukkit.v1_20_R2.CraftServer.enablePlugins(CraftServer.java:555) ~[paper-1.20.2.jar:git-Paper-222]
	at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:627) ~[paper-1.20.2.jar:git-Paper-222]
	at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:424) ~[paper-1.20.2.jar:git-Paper-222]
	at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:308) ~[paper-1.20.2.jar:git-Paper-222]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1086) ~[paper-1.20.2.jar:git-Paper-222]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.20.2.jar:git-Paper-222]
	at java.lang.Thread.run(Unknown Source) ~[?:?]
Caused by: org.bukkit.configuration.InvalidConfigurationException: Could not call method 'public static org.bukkit.inventory.meta.ItemMeta org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem$SerializableMeta.deserialize(java.util.Map) throws java.lang.Throwable' of class org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem$SerializableMeta for deserialization
	at com.nisovin.shopkeepers.util.bukkit.ConfigUtils.loadConfigSafely(ConfigUtils.java:247) ~[Shopkeepers-2.18.1-SNAPSHOT.jar:?]
	at com.nisovin.shopkeepers.util.data.persistence.bukkit.BukkitConfigDataStore.loadFromString(BukkitConfigDataStore.java:61) ~[Shopkeepers-2.18.1-SNAPSHOT.jar:?]
	... 16 more
Caused by: java.lang.IllegalArgumentException: BlockStateTag({
    honey_level: "5"
}) is not a valid interface java.util.Map
	at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem$SerializableMeta.getObject(CraftMetaItem.java:241) ~[paper-1.20.2.jar:git-Paper-222]
	at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem.<init>(CraftMetaItem.java:547) ~[paper-1.20.2.jar:git-Paper-222]
	at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaBlockState.<init>(CraftMetaBlockState.java:164) ~[paper-1.20.2.jar:git-Paper-222]
	at jdk.internal.reflect.GeneratedConstructorAccessor77.newInstance(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
	at java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:?]
	at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem$SerializableMeta.deserialize(CraftMetaItem.java:205) ~[paper-1.20.2.jar:git-Paper-222]
	at jdk.internal.reflect.GeneratedMethodAccessor99.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
	at org.bukkit.configuration.serialization.ConfigurationSerialization.deserializeViaMethod(ConfigurationSerialization.java:85) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.serialization.ConfigurationSerialization.deserialize(ConfigurationSerialization.java:127) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.serialization.ConfigurationSerialization.deserializeObject(ConfigurationSerialization.java:207) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:58) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:264) ~[snakeyaml-2.2.jar:?]
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:247) ~[snakeyaml-2.2.jar:?]
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:576) ~[snakeyaml-2.2.jar:?]
	at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:210) ~[snakeyaml-2.2.jar:?]
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:552) ~[snakeyaml-2.2.jar:?]
	at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:597) ~[snakeyaml-2.2.jar:?]
	at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:49) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:264) ~[snakeyaml-2.2.jar:?]
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:247) ~[snakeyaml-2.2.jar:?]
	at org.bukkit.configuration.file.YamlConstructor.construct(YamlConstructor.java:37) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.file.YamlConfiguration.fromNodeTree(YamlConfiguration.java:163) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.file.YamlConfiguration.fromNodeTree(YamlConfiguration.java:161) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.file.YamlConfiguration.fromNodeTree(YamlConfiguration.java:161) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.file.YamlConfiguration.fromNodeTree(YamlConfiguration.java:161) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:120) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at com.nisovin.shopkeepers.util.bukkit.ConfigUtils.loadConfigSafely(ConfigUtils.java:240) ~[Shopkeepers-2.18.1-SNAPSHOT.jar:?]
	at com.nisovin.shopkeepers.util.data.persistence.bukkit.BukkitConfigDataStore.loadFromString(BukkitConfigDataStore.java:61) ~[Shopkeepers-2.18.1-SNAPSHOT.jar:?]
	... 16 more
commented

Resolved in 3909-Spigot-e0e223f-ad0e574

commented

Can you attach your save.yml file, and please also try if the plugin can load the save file on an up-to-date Spigot server.

commented

Spigot version: 3908-Spigot-e0e223f-b3efca5 (MC: 1.20.2) (Implementing API version 1.20.2-R0.1-SNAPSHOT)

[Server thread/ERROR]: [Shopkeepers] Failed to load the save file! Note: Server downgrades or manually editing the save file are not supported!
com.nisovin.shopkeepers.util.data.persistence.InvalidDataFormatException: Failed to load data as Bukkit config!
	at com.nisovin.shopkeepers.util.data.persistence.bukkit.BukkitConfigDataStore.loadFromString(BukkitConfigDataStore.java:63) ~[?:?]
	at com.nisovin.shopkeepers.util.data.persistence.DataStoreBase.load(DataStoreBase.java:58) ~[?:?]
	at com.nisovin.shopkeepers.storage.SKShopkeeperStorage.doReload(SKShopkeeperStorage.java:456) ~[?:?]
	at com.nisovin.shopkeepers.storage.SKShopkeeperStorage.reload(SKShopkeeperStorage.java:408) ~[?:?]
	at com.nisovin.shopkeepers.SKShopkeepersPlugin.onEnable(SKShopkeepersPlugin.java:409) ~[?:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:266) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.craftbukkit.v1_20_R2.CraftServer.enablePlugin(CraftServer.java:548) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3908-Spigot-e0e223f-b3efca5]
	at org.bukkit.craftbukkit.v1_20_R2.CraftServer.enablePlugins(CraftServer.java:462) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3908-Spigot-e0e223f-b3efca5]
	at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:577) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3908-Spigot-e0e223f-b3efca5]
	at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:400) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3908-Spigot-e0e223f-b3efca5]
	at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:250) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3908-Spigot-e0e223f-b3efca5]
	at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:954) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3908-Spigot-e0e223f-b3efca5]
	at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:298) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3908-Spigot-e0e223f-b3efca5]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: org.bukkit.configuration.InvalidConfigurationException: Could not call method 'public static org.bukkit.inventory.meta.ItemMeta org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem$SerializableMeta.deserialize(java.util.Map) throws java.lang.Throwable' of class org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem$SerializableMeta for deserialization
	at com.nisovin.shopkeepers.util.bukkit.ConfigUtils.loadConfigSafely(ConfigUtils.java:247) ~[?:?]
	at com.nisovin.shopkeepers.util.data.persistence.bukkit.BukkitConfigDataStore.loadFromString(BukkitConfigDataStore.java:61) ~[?:?]
	... 15 more
Caused by: java.lang.IllegalArgumentException: BlockStateTag({
    honey_level: "5"
}) is not a valid interface java.util.Map
	at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem$SerializableMeta.getObject(CraftMetaItem.java:233) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3908-Spigot-e0e223f-b3efca5]
	at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem.<init>(CraftMetaItem.java:488) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3908-Spigot-e0e223f-b3efca5]
	at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaBlockState.<init>(CraftMetaBlockState.java:164) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3908-Spigot-e0e223f-b3efca5]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?]
	at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem$SerializableMeta.deserialize(CraftMetaItem.java:197) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3908-Spigot-e0e223f-b3efca5]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.bukkit.configuration.serialization.ConfigurationSerialization.deserializeViaMethod(ConfigurationSerialization.java:85) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.serialization.ConfigurationSerialization.deserialize(ConfigurationSerialization.java:127) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.serialization.ConfigurationSerialization.deserializeObject(ConfigurationSerialization.java:207) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:58) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:264) ~[snakeyaml-2.2.jar:?]
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:247) ~[snakeyaml-2.2.jar:?]
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:576) ~[snakeyaml-2.2.jar:?]
	at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:210) ~[snakeyaml-2.2.jar:?]
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:552) ~[snakeyaml-2.2.jar:?]
	at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:597) ~[snakeyaml-2.2.jar:?]
	at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:49) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:264) ~[snakeyaml-2.2.jar:?]
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:247) ~[snakeyaml-2.2.jar:?]
	at org.bukkit.configuration.file.YamlConstructor.construct(YamlConstructor.java:37) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.file.YamlConfiguration.fromNodeTree(YamlConfiguration.java:162) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.file.YamlConfiguration.fromNodeTree(YamlConfiguration.java:160) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.file.YamlConfiguration.fromNodeTree(YamlConfiguration.java:160) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.file.YamlConfiguration.fromNodeTree(YamlConfiguration.java:160) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:119) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at com.nisovin.shopkeepers.util.bukkit.ConfigUtils.loadConfigSafely(ConfigUtils.java:240) ~[?:?]
	at com.nisovin.shopkeepers.util.data.persistence.bukkit.BukkitConfigDataStore.loadFromString(BukkitConfigDataStore.java:61) ~[?:?]
	... 15 more

Save file:

# This file is not intended to be manually modified! If you want to manually edit this file anyways, ensure that the server is not running currently and that you have prepared a backup of this file.

data-version: 3|2|3578
'1':
  uniqueId: 2ad61918-f613-48d5-8a98-f8cdba6e0e30
  world: world
  x: -112
  y: 71
  z: 28
  yaw: 345.21924
  type: admin
  name: ''
  object:
    type: villager
    baby: false
    profession: NONE
    villagerType: PLAINS
    villagerLevel: 1
  recipes:
    '1':
      resultItem:
        ==: org.bukkit.inventory.ItemStack
        v: 3578
        type: BEE_NEST
        meta:
          ==: ItemMeta
          meta-type: TILE_ENTITY
          BlockStateTag: |-
            {
                honey_level: "5"
            }
          internal: H4sIAAAAAAAA/+NiYOBi4HPKyU/Ods0rySypDElM52RgcUpNLWaAAACK5YvWIgAAAA==
          blockMaterial: BEE_NEST
      item1:
        ==: org.bukkit.inventory.ItemStack
        v: 3578
        type: DIAMOND
  snapshots: []
commented

There is no error, when file is manually modified like that:

# This file is not intended to be manually modified! If you want to manually edit this file anyways, ensure that the server is not running currently and that you have prepared a backup of this file.

data-version: 3|2|3578
'1':
  uniqueId: 2ad61918-f613-48d5-8a98-f8cdba6e0e30
  world: world
  x: -112
  y: 71
  z: 28
  yaw: 345.21924
  type: admin
  name: ''
  object:
    type: villager
    baby: false
    profession: NONE
    villagerType: PLAINS
    villagerLevel: 1
  recipes:
    '1':
      resultItem:
        ==: org.bukkit.inventory.ItemStack
        v: 3578
        type: BEE_NEST
        meta:
          ==: ItemMeta
          meta-type: TILE_ENTITY
          BlockStateTag:
            {
                honey_level: "5"
            }
          internal: H4sIAAAAAAAA/+NiYOBi4HPKyU/Ods0rySypDElM52RgcUpNLWaAAACK5YvWIgAAAA==
          blockMaterial: BEE_NEST
      item1:
        ==: org.bukkit.inventory.ItemStack
        v: 3578
        type: DIAMOND
  snapshots: []
commented

I was able to reproduce the issue. I think it is related to a recent change in Spigot to how custom plugin item data is serialized, which also affected the serialization of block state data (the BlockStateTag section): This data is now serialized as a string rather than a Map/Object. But the deserialization was not adjusted accordingly, so during deserialization the server still expects this data to be a Map rather than a string and therefore fails to load it.

I have created a Spigot ticket here: https://hub.spigotmc.org/jira/browse/SPIGOT-7502