mojira.dev
MC-298717

Unreadable JsonSyntaxException on corrupt banned-players.json

When the banned-ips.json or banned-players.json files of a dedicated server don’t contain a JSON array, but for example a JSON object (like {}), the error message on startup does not point the casual server owner towards the knowledge that these two files are the problem.

There should be information added which file has the problem to drastically decrease the time players have to search for the reason of the crash.

[10:37:08] [Server thread/ERROR]: Encountered an unexpected exception
com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonArray but was com.google.gson.JsonObject; at path $
	at com.google.gson.internal.bind.TypeAdapters$34$1.read(TypeAdapters.java:1152) ~[gson-2.11.0.jar:?]
	at com.google.gson.Gson.fromJson(Gson.java:1361) ~[gson-2.11.0.jar:?]
	at com.google.gson.Gson.fromJson(Gson.java:1262) ~[gson-2.11.0.jar:?]
	at com.google.gson.Gson.fromJson(Gson.java:1199) ~[gson-2.11.0.jar:?]
	at ayg.f(SourceFile:119) ~[server-1.21.8.jar:?]
	at arh.z(SourceFile:85) ~[server-1.21.8.jar:?]
	at arh.<init>(SourceFile:24) ~[server-1.21.8.jar:?]
	at ari.e(SourceFile:174) ~[server-1.21.8.jar:?]
	at net.minecraft.server.MinecraftServer.y(SourceFile:672) ~[server-1.21.8.jar:?]
	at net.minecraft.server.MinecraftServer.a(SourceFile:291) ~[server-1.21.8.jar:?]
	at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
[10:37:08] [Server thread/ERROR]: This crash report has been saved to [...]

Edit: this is partially fixed now that minecraft is distributed unobfuscated, but its still hard to see what the real problem is for a non-technically experienced user:

[09:33:51] [Server thread/ERROR]: Encountered an unexpected exception
com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonArray but was com.google.gson.JsonObject; at path $
	at com.google.gson.internal.bind.TypeAdapters$32$1.read(TypeAdapters.java:923)
	at com.google.gson.Gson.fromJson(Gson.java:1358)
	at com.google.gson.Gson.fromJson(Gson.java:1259)
	at com.google.gson.Gson.fromJson(Gson.java:1197)
	at net.minecraft.server.players.StoredUserList.load(StoredUserList.java:141)
	at net.minecraft.server.dedicated.DedicatedPlayerList.loadUserBanList(DedicatedPlayerList.java:65)
	at net.minecraft.server.dedicated.DedicatedPlayerList.<init>(DedicatedPlayerList.java:22)
	at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:213)
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:741)
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320)
	at java.base/java.lang.Thread.run(Thread.java:1474)
[09:33:51] [Server thread/ERROR]: This crash report has been saved to: [...]

In line 8 you can see that its the user ban list, but its still not directly visible if you don’t know how to read a stacktrace.

Linked issues

Comments 0

No comments.

McModknower

(Unassigned)

Plausible

Platform

Normal

Crash, Dedicated Server

1.21.5, 1.21.6 Release Candidate 1, 1.21.8, 26.2 Snapshot 7

Retrieved