Repository navigation
Unable to execute commands in console before worlds are loaded #13580
Description
Expected behavior
All commands executed w/o issues after the server is done loading.
Observed/Actual behavior
Command exception: /version
java.lang.NullPointerException: Cannot invoke "net.minecraft.server.level.ServerLevel.getGameRules()" because the return value of "net.minecraft.commands.CommandSourceStack.getLevel()" is null
at net.minecraft.commands.Commands.executeCommandInContext(Commands.java:462) ~[paper-1.21.11.jar:1.21.11-90-4b35f5c]
at net.minecraft.commands.Commands.performCommand(Commands.java:374) ~[paper-1.21.11.jar:1.21.11-90-4b35f5c]
at net.minecraft.commands.Commands.performCommand(Commands.java:362) ~[paper-1.21.11.jar:1.21.11-90-4b35f5c]
at net.minecraft.commands.Commands.performPrefixedCommand(Commands.java:353) ~[paper-1.21.11.jar:1.21.11-90-4b35f5c]
at net.minecraft.server.dedicated.DedicatedServer.handleConsoleInputs(DedicatedServer.java:594) ~[paper-1.21.11.jar:1.21.11-90-4b35f5c]
at net.minecraft.server.dedicated.DedicatedServer.tickConnection(DedicatedServer.java:550) ~[paper-1.21.11.jar:1.21.11-90-4b35f5c]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1838) ~[paper-1.21.11.jar:1.21.11-90-4b35f5c]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1616) ~[paper-1.21.11.jar:1.21.11-90-4b35f5c]
at net.minecraft.server.dedicated.DedicatedServer.tickServer(DedicatedServer.java:427) ~[paper-1.21.11.jar:1.21.11-90-4b35f5c]
at net.minecraft.server.MinecraftServer.processPacketsAndTick(MinecraftServer.java:1672) ~[paper-1.21.11.jar:1.21.11-90-4b35f5c]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1340) ~[paper-1.21.11.jar:1.21.11-90-4b35f5c]
at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:388) ~[paper-1.21.11.jar:1.21.11-90-4b35f5c]
at java.base/java.lang.Thread.run(Thread.java:1474) ~[?:?]
An unexpected error occurred trying to execute that command
Steps/models to reproduce
1. Install Windows Server 2025
2. Install Java 25
3. Download Paper from https://papermc.io/downloads/paper
4. Create a start script using https://docs.papermc.io/misc/tools/start-script-gen/
5. Run the server using generated script
6. Accept Mojang EULA
7. Download some plugins (at least 10) so that it takes some time to start the server
8. Run the server using the script again
9. During loading of the server, execute any command (i.e. version)
10. Wait for the server to finish loading & enabling plugins
11. Meet the exception
Plugin and Datapack List
As I understand it, list of plugins doesn't matter.
There are 3 data pack(s) enabled: [vanilla (built-in)], [paper (built-in)], [file/Bukkit (world)]]
There are no more data packs available
Paper version
This server is running Paper version 1.21.11-90-main@4b35f5c (2026-01-09T18:48:48Z) (Implementing API version 1.21.11-R0.1-SNAPSHOT)
You are 9 version(s) behind
Other
No response
Metadata
Metadata
Assignees
Labels
Type
Fields
MC Issue
Activity
CommandSourceStack#getLocation()#13387Doc94 commentedon Jan 26, 2026
Confirmed in https://mojira.dev/MC-305939 its a Vanilla Bug.
[-]An unexpected error occurred[/-][+]Unable to execute commands in console before worlds are loaded[/+]Magicrafter13 commentedon Jul 13, 2026
Could we create a temporary workaround by not opening the stdin reader until the world is loaded, perhaps?
wangzhizhou commentedon Oct 2, 2026
Confirming this is still present on Paper 26.2 (reported on 26.2-126; reproduced on 26.2-129) and — importantly — it reproduces with zero plugins, so it is definitely unrelated to any plugin:
Minimal repro (no plugins, only built-in datapacks):
Done (…)appears, type a vanilla command in the console, e.g.list.Command exception: /list+ the same NPE.The exact same command issued after
Done (…)succeeds, and running the server without any plugins changes nothing — soplugin listis indeed irrelevant.Consistent with the
upstream: vanillalabel: a console line entered before the overworld is loaded is queued as aConsoleInputcarrying theCommandSourceStackbuilt at that moment byMinecraftServer#createCommandSourceStack(), whose level isfindRespawnDimension()→overworld()(null while worlds are loading). When the queue is drained,Commands#executeCommandInContextbuilds theExecutionContextwith an unconditionalgetLevel().getGameRules(...)(verified by disassembly ofnet.minecraft.commands.Commands).