Shopkeepers

Shopkeepers

2M Downloads

Failed to load the save file!

Jyph opened this issue ยท 6 comments

commented

Preliminaries:

  • Shopkeepers version: 2.23.0
  • Spigot version: 1.7.11

  • I have checked that my issue/question does not get answered by:
  • I have checked all open and closed issues, but none seems to fit my issue/question.

Reproduction on a fresh and up-to-date Spigot server:

I was able to reproduce my issue on a freshly set up and up-to-date Spigot server (currently 1.7.11) with the latest version of Shopkeepers (untested, ngl), with no other plugins (untested) and with no kinds of other server or client mods (untested).

The issue:

A failure to load the save file. My best guess is the Version being wrong ( 3 | 2 | 3953 ). Is there a debug option that would tell me where the corruption in the save file is in? To note, its a large file ( 1052 KB ) and there was one common denominator with Discord SRV. Discord SRV was removed after the error occurred, and the error still occurs with more tests.

More notes, this isn't for me. A friend of mine. I know medium amounts of Java while they don't.

More notes... sorry. The Server crashed at 7 AM CT. It was restarted and the Shopkeepers failed to load, with the error: "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!". It was thrown from the try/catch exception at doReload(com.nisovin.shopkeepers.storage.SKShopKepperStorage.java:461) and happened at loadFromString(com.nisovin.shopkeepers.util.data.persistence.bukkit.BukkitConfigDataSore:63).

I have the save.yml and config.yml at the ready.

commented

message.txt
save.txt
This is the original save file. We tested fixing the number starting on 2 (by adding a new shopkeeper from another test that worked to it)
save_with_1_shopkeeper.txt
Also tested whether or not you could replace the recipes instead of adding new shopkeepers and that worked. My best guess now is that there is another file keeping count of the Shopkeepers?

To be Noted:

  1. save_with_1_shopkeeper.txt was automatically generated entirely after we had issues with the original save. We deleted the save.yml after backing it up We created that shopkeeper as intended in the server before closing the server and isolating the save.yml
  2. github wont let me post ".yml" extensions. The files are renamed to ".txt" for sharing
commented

message.txt
save.txt
This is the original save file. We tested fixing the number starting on 2 (by adding a new shopkeeper from another test that worked to it)
save_with_1_shopkeeper.txt
Also tested whether or not you could replace the recipes instead of adding new shopkeepers and that worked. My best guess now is that there is another file keeping count of the Shopkeepers?

To be Noted:

  1. save_with_1_shopkeeper.txt was automatically generated entirely after we had issues with the original save. In order, we shut the server down, deleted the "save.yml" from the "plugins/Shopkeepers/data" folder, started the server back up, placed a new Shopkeeper with temporary stuff, left the server, shut the server down, and downloaded the newly generated "save.yml" as "save_with_1_shopkeeper".
  2. github wont let me post ".yml" extensions. The files are renamed to ".txt" for sharing
  3. After uploading back to the server, they were renamed to "save.yml" (by us) before starting the server.
  4. The server was not terminated in the tests. The server was shutdown after all closing processes happened, not forcefully powered off.
commented

Is there a limit to the save.yml file? (the current one in use is 1.053 KB).

None that I am aware of.

Regarding the issue: The error can also be the effect of some other issue with loading the save data. The complete error stack trace would be useful, as well as the original save.yml file.

My guess: There have been some item data changes in 1.20.5+ server versions. Most notably, various custom head items created in earlier server versions are no longer load-able. Maybe this affects you as well. See for example: #907

Unfortunately, there is no automatic migration to resolve this issue, so if you / your friend are affected by this issue, you need to manually modify any affected head items inside the save file. The linked ticket contains a link to a comment on Spigot with information on how to do that for example relatively quickly by using Notepad++'s replace feature and regular expressions.

commented

Caused by: java.lang.IllegalArgumentException: uniqueId is null or name is blank
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:143) ~[guava-32.1.2-jre.jar:?]
at org.bukkit.craftbukkit.v1_21_R1.profile.CraftPlayerProfile.(CraftPlayerProfile.java:55) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4289-Spigot-fb8fb72-8ee6fd1]
at org.bukkit.craftbukkit.v1_21_R1.profile.CraftPlayerProfile.deserialize(CraftPlayerProfile.java:263) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4289-Spigot-fb8fb72-8ee6fd1]

This is the player head issue I mentioned above. See the linked ticket. Basically, you need to manually replace all invalid player head profile names (they must be valid player names now, i.e. not contain any space and only use basic characters) and add missing uniqueId values.
Example: Line 20848 (shopkeeper 115, trade 5:

    '5':
      resultItem:
        ==: org.bukkit.inventory.ItemStack
        v: 3953
        type: PLAYER_HEAD
        meta:
          ==: ItemMeta
          meta-type: SKULL
          display-name: '{"text":"","extra":[{"text":"Pancakes","color":"#FFCC99"}]}'
          max-stack-size: 8
          food:
            ==: Food
            nutrition: 5
            saturation: 10.0
            can-always-eat: true
            eat-seconds: 2.0
            effects:
            - ==: FoodEffect
              effect:
                ==: PotionEffect
                effect: minecraft:speed
                duration: 2000
                amplifier: 2
                ambient: false
                has-particles: false
                has-icon: false
              probability: 0.2
          skull-owner:
            ==: PlayerProfile
            properties:
            - name: textures
              value: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjg0NTE2NjgzOTIwMjJhM2Y3NzgzM2M4NDFjMmIzMTc4Y2UxMWE5Yzk3NTA0NjFlNTFkZmExMmUwMWMzYjFiNyJ9fX0=

Compare this with other head items in your save file and you notice that the PlayerProfile section of this item is missing an uniqueId field. To fix it, just add a uniqueId field in the save file for each player head item that is missing it. The actual value doesn't really matter, and also doesn't need to be unique across items. It just needs to be a valid uuid.


We tested fixing the number starting on 2 (by adding a new shopkeeper from another test that worked to it)

This is not an issue, and actually intended: Although the plugin doesn't guarantee this, it tries to preserve these storage ids. So if you delete a shopkeeper, the id is deleted from the save file.

My best guess now is that there is another file keeping count of the Shopkeepers?

There is no other file. The ids don't matter other than allowing to refer to the shopkeepers by these ids in commands (in addition to shopkeeper names and unique ids).

commented
  • 3953 indicates that your save file was created on a 1.21 server (see https://minecraft.wiki/w/Data_version)
  • You mention to run server version 1.7.11 (?): I am not sure what server version this is (the Minecraft wiki only mentions 1.7.10). I also didn't find any Shopkeepers plugin version explicitly mentioning to be compatible with 1.7.10, only 1.7.9.
  • In either case: The error message indicates that you are trying to load the save file on an older Minecraft version, which is not supported. There is no workaround, especially with this large of a version difference.
commented

sorry, 1.21 is the spigot version. The friend was misled to believe that the spigot version was 1.7.11. Restarting without a save.yml created a new one and it worked. Is there a limit to the save.yml file? (the current one in use is 1.053 KB).