Server setup

Server Crash: java.lang.AssertionError: TRAP (ItemStack.checkEmpty)

What the log looks like

java\.lang\.AssertionError:\s*TRAP
ItemStack\.checkEmpty\(ItemStack\.java:\d+\)

How to fix it

  1. Update your Paper or Spigot server JAR to the latest available build for your Minecraft version, as Paper regularly patches vanilla edge cases that trigger ItemStack.checkEmpty.
  2. Inspect the lines immediately below ItemStack.setCount or ItemStack.subtract in your crash log to identify the exact trigger.
  3. If MerchantRecipe is in the stack trace, locate and remove any custom villager or wandering trader summoned with only a second buy slot (buyB), and always define a valid item in the first buy slot (buy).
  4. If PlayerInteractManager or ItemBlock is in the stack trace, identify the plugin modifying the player's held item on right-click and update it—or if it is your own plugin, call event.setCancelled(true) whenever setting the used item to null or AIR.
  5. If Loading entity NBT or ChunkRegionLoader appears in the log, open the affected region file in NBTExplorer and delete the entity containing malformed item data (such as an air item or zero-count stack with NBT tags).
LoadersServer
SeverityStops the game
CategoryServer setup

Check your own log

Related errors