mojira.dev
MC-256230

Large bossbar texts fail to save to level.dat, crashing on relog

The bug

When a text component resolved in a bossbar saves to a string greater than 65536 characters, the game writes null to the entry in level.dat, which causes a crash upon reloading the world.

How to reproduce

/summon marker
/summon marker
/execute at @e[type=marker] at @e[type=marker] at @e[type=marker] at @e[type=marker] at @e[type=marker] at @e[type=marker] at @e[type=marker] at @e[type=marker] run summon marker
/bossbar add test:test {"selector":"@e[type=marker]"}
/bossbar set test:test players @p

Now save and quit from the world and attempt to rejoin.

→ ❌ The game crashes just before loading

java.lang.NullPointerException: Cannot invoke "ru.a(ru$b, sj)" because "$$0" is null
    at amv.a(SourceFile:128)
    at egh.a(SourceFile:49)
    at eha.a(SourceFile:368)
    at eho.a(SourceFile:46)
    at ehb.a(SourceFile:218)
    at ezl.a(SourceFile:862)
    at efu.f(SourceFile:1177)
    at efu.e(SourceFile:768)
    at net.minecraft.client.main.Main.a(SourceFile:244)
    at net.minecraft.client.main.Main.main(SourceFile:51)

Additionally, this is logged when attempting to save the world:

[16:31:04] [Server thread/ERROR]: Failed to write NBT String
java.io.UTFDataFormatException: encoded string ({"extra"...ext":""}) too long: 74296 bytes
    at java.io.DataOutputStream.writeUTF(DataOutputStream.java:369) ~[?:?]
    at java.io.DataOutputStream.writeUTF(DataOutputStream.java:333) ~[?:?]
    at qa.a(SourceFile:83) ~[1.19.2.jar:?]
    at pj.a(SourceFile:476) ~[1.19.2.jar:?]
    at pj.a(SourceFile:165) ~[1.19.2.jar:?]
    at pj.a(SourceFile:476) ~[1.19.2.jar:?]
    at pj.a(SourceFile:165) ~[1.19.2.jar:?]
    at pj.a(SourceFile:476) ~[1.19.2.jar:?]
    at pj.a(SourceFile:165) ~[1.19.2.jar:?]
    at pj.a(SourceFile:476) ~[1.19.2.jar:?]
    at pj.a(SourceFile:165) ~[1.19.2.jar:?]
    at pt.a(SourceFile:134) ~[1.19.2.jar:?]
    at pt.a(SourceFile:99) ~[1.19.2.jar:?]
    at pt.a(SourceFile:60) ~[1.19.2.jar:?]
    at pt.a(SourceFile:54) ~[1.19.2.jar:?]
    at drq$c.a(SourceFile:391) ~[1.19.2.jar:?]
    at net.minecraft.server.MinecraftServer.a(SourceFile:533) ~[1.19.2.jar:?]
    at net.minecraft.server.MinecraftServer.b(SourceFile:550) ~[1.19.2.jar:?]
    at fnm.a(SourceFile:86) ~[1.19.2.jar:?]
    at net.minecraft.server.MinecraftServer.v(SourceFile:665) ~[1.19.2.jar:?]
    at net.minecraft.server.MinecraftServer.a(SourceFile:257) ~[1.19.2.jar:?]
    at java.lang.Thread.run(Thread.java:833) [?:?]

Linked issues

Attachments

Comments 2

Can confirm in 1.19.3 and 23w03a

The change in 25w02a that made text components save as NBT instead of JSON strings has I believe effectively fixed this.

tryashtar

(Unassigned)

Confirmed

Platform

Important

Crash

1.19.2, 1.19.3, 23w03a, 1.20.5 Pre-Release 1, 1.21.1

Retrieved