Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-164446

Tags don't load if one of their values is invalid, causing all data packs to unload

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 20w14a
    • 1.14.4, 19w42a, 1.15 Pre-release 4, 1.15, 1.15.1, 1.15.1 Pre-release 1
    • Confirmed
    • Commands
    • Low

      The bug

      While this may seem intended at first, it is actually inconsistent with function loading and it causes some major problems.

      If a function is not recognized while loading, the error is not detected and will be dealt with at runtime, causing that command to be ignored. This is useful because a data pack may rely on another data pack. If that other data pack is not available, we don't want our own data pack to break.

      In contrast, if a function tag has an invalid function as one of its values, the whole tag is made invalid. This can cause a chain reaction which can cause other data packs to stop working. Like shown in the attached screenshot, this can also cause all data packs to unload.

      How to reproduce

      Steps to unload one tag:

      1. Download the "test1.zip" file and place it in the datapacks folder of your world. This is a data pack with one function tag.
      2. Reload the data pack and notice an error in the log
        Couldn't read function tag list minecraft:foo from minecraft:tags/functions/foo.json in data pack test
        com.google.gson.JsonParseException: Unknown value 'minecraft:bar'
        ... 

      Steps to unload #minecraft:load and break other data packs

      1. Download the "test2.zip" file and place it in the datapacks folder of your world. This is a data pack with two function tags. The #minecraft:load tag has one entry #test:foo which itself also has one entry #test:bar. However, this last tag does not exist.
      2. Reload the data pack and notice an error in the log
        Couldn't load function tag test:foo as it either references another tag that doesn't exist, or ultimately references itself
        Couldn't load function tag minecraft:load as it either references another tag that doesn't exist, or ultimately references itself
        Failed to reload data packsjava.util.concurrent.ExecutionException: java.lang.IllegalStateException: Cannot build unresolved tag entry
        ...

        The full error message from the log is available here.

      1. Notice that the vanilla data pack is completely disabled (even though it appears enabled when you run /datapack list). See screenshot-1.png

       

      The worst part is that is doesn't tell you in which data pack or function file the error is, so debugging any problems with tags is a pain.

        1. MinecraftLauncher_2019-10-28_21-31-19.png
          MinecraftLauncher_2019-10-28_21-31-19.png
          38 kB
        2. screenshot-1.png
          screenshot-1.png
          8 kB
        3. test1.zip
          0.4 kB
        4. test2.zip
          1 kB

            boq [Mojang] Bartosz Bok
            Misoloo [Helper] Misode
            Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: