mojira.dev
MC-260367

Crash when damaging a Guardian using a command block: java.lang.StackOverflowError: Executing command block

The bug

The server crashes when executing /damage on a Guardian a couple of times using a command block, with the same mob also being as its source of the damage.
The crash does not happen when executing through chat, instead the command itself will just not work at all, as if you have never typed it in the first place.

Also happens with Elder Guardians, including Elder Guardians doing /damage to Guardians and vice versa.

Steps to reproduce

  1. Create a new world without experiments enabled

  2. Locate an ocean monument and teleport there

  3. Place a command block with this command:

    damage @e[type=guardian,limit=1] 1 generic by @e[type=guardian,limit=1]
  4. Activate the block multiple times
    → ❌ The server eventually encounters a stack overflow error and crashes, along with the game if done on singleplayer

Stack trace

23w07a\: [^crash-2023-02-19_19.51.11-server.txt]

Description: Executing command block

java.lang.StackOverflowError: Executing command block
	at acl.a(SourceFile:117)
	at bvv.fQ(SourceFile:133)
	at bvv.a(SourceFile:344)
	at bvv.a(SourceFile:349)
	at bvv.a(SourceFile:349)
	at bvv.a(SourceFile:349)
	at bvv.a(SourceFile:349)
	at bvv.a(SourceFile:349)
	at bvv.a(SourceFile:349)
	at bvv.a(SourceFile:349)
	at bvv.a(SourceFile:349)
	at bvv.a(SourceFile:349)
	...

Linked issues

Attachments

Comments 5

This happens because guardians are trying to damage themselves with their own thorns, which themselves trigger the thorns, and so forth.

If you overwrite tags/damage_type/avoids_guardian_thorns and remove thorns from its values, this issue still reproduces in 1.19.4 Pre-release 1.

@@unknown, I can't reproduce.

This is the data package I use:

[media]

avoids_guardian_thorns.json

{
  "values": [
    "minecraft:magic",
    "#minecraft:is_explosion"
  ]
}

Either way, if this still happens under some conditions, please file a new bug report.

Tags are merged with the file of the same resource location from the previously loaded datapack by default, so you need to set replace to true to remove thorns.
Anyway, I have created a new report MC-260579.

avoids_guardian_thorns.json

{
  "replace": true,
  "values": [
    "minecraft:magic",
    "#minecraft:is_explosion"
  ]
}

tqz78

Panda4994

Confirmed

Platform

Very Important

Commands, Crash

23w07a

1.19.4 Pre-release 1

Retrieved