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

Setting certain fields in NBT to invalid characters causes exceptions to be logged, potentially causing lag

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.21, 24w33a, 1.21.1 Release Candidate 1, 1.21.1, 24w34a, 24w35a, 24w36a, 24w37a, 24w38a, 24w39a, 24w40a
    • None
    • Confirmed
    • Commands, Performance
    • Low
    • Platform

      The Bug

      When setting certain NBT fields to invalid characters (such as ? and =), an exception is outputted in the log. A large amount of exceptions can cause lag to most systems.

      Examples of some fields that cause errors when invalid characters are entered include RecipesUsed, LootTable, Name, and possibly more.

      Steps to Reproduce (Direct)

      Run the command specified for all situations below, then look in the game logs. Note if there is a stack trace exception or not.

      Placing Suspicious Sand with invalid LootTable:
      Place down the block this command gives you, and check the log.

      /give @s minecraft:suspicious_sand[minecraft:block_entity_data={id:brushable_block,LootTable:"?"}]

      FallingBlock entity with invalid Name:
      This displays an error message in chat as well.

      Running the command below in a repeating command block causes high MSPT lag.

      /summon minecraft:falling_block ~ ~ ~ {BlockState:{"Name":"?"}}

      FallingBlock entity with invalid LootTable:

      /summon minecraft:falling_block ~ ~ ~ {BlockState:{"Name":"suspicious_sand"},TileEntityData:{LootTable:"?"}}

      Steps to Reproduce (Spawner)

      This may cause severe FPS lag.

      Run the command below (attempting to right-click this spawn egg on the ground will also output an exception and not spawn anything):

      /give @s minecraft:breeze_spawn_egg[minecraft:entity_data={id:arrow,inBlockState:{Name:"?"}}]

      Place a monster spawner below you, and right-click the spawner with the spawn egg.

      Run the command below while on top of the spawner:

      /data modify block ~ ~-1 ~ SpawnData.entity.inBlockState set value {Name:"?"}

      View the game logs and note if stack trace exceptions are spammed or not.

      Observed Results

      Exceptions are sometimes spammed to the game's log. In some cases, an FPS and TPS drop is noticeable. In the case of the spawner bug, errors continue to be spammed even when on the Esc menu in singleplayer.

      The log file can also be huge due to these exceptions being spammed.

      See the following text files for the exceptions experienced. They are all named respective to the thing which caused it.

      Expected Result

      There would be no spammed exceptions. Instead, an error message could be logged informing the player of the issue.

            Unassigned Unassigned
            Arnav78 Viradex
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              CHK: