PaperMC / PaperMC/Paper

Teleporting player outside level coordinates crashes the server

Open
#13,186 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: accepted version: 1.21.10
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Stack trace

teleportAsync(): https://mclo.gs/bu9wHY1
teleport(): https://mclo.gs/kwRYdYq

Plugin and Datapack List
@EventHandler(ignoreCancelled = true)
public void onAsyncChat(AsyncChatEvent event) {
    var player = event.getPlayer();
    var location = player.getLocation().add(0, 0, 100000000);
    if (event.signedMessage().message().contains("1")) {
        player.teleportAsync(location);
        return;
    }
    if (event.signedMessage().message().contains("2")) {
        getServer().getScheduler().runTask(this, () -> player.teleport(location));
    }
}
Actions to reproduce (if known)

See code above. Note that after teleporting the player on the main thread and restarting the server, the server soft locks if the player joins (seen below). This doesn't happen if the teleport is done async.

[22:00:41 INFO]: Done (6.036s)! For help, type "help"
[22:01:02 INFO]: UUID of player Kopo942 is 25f5129d-2f02-4e1e-81e5-1e28481017a0
[22:01:02 ERROR]: Failed to tick configuration task prepare_spawn
java.lang.IllegalStateException: Trying to create chunk out of reasonable bounds: [2, 6249997]
	at net.minecraft.server.level.GenerationChunkHolder.<init>(GenerationChunkHolder.java:35) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.server.level.ChunkHolder.<init>(ChunkHolder.java:147) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder.<init>(NewChunkHolder.java:656) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkHolderManager.createChunkHolder(ChunkHolderManager.java:942) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkHolderManager$2.processLevelUpdates(ChunkHolderManager.java:384) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ThreadedTicketLevelPropagator.performUpdate(ThreadedTicketLevelPropagator.java:308) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ThreadedTicketLevelPropagator.performUpdates(ThreadedTicketLevelPropagator.java:370) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkHolderManager.processTicketUpdates(ChunkHolderManager.java:1433) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler.scheduleTickingState(ChunkTaskScheduler.java:393) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler.scheduleChunkLoad(ChunkTaskScheduler.java:588) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at ca.spottedleaf.moonrise.paper.util.BaseChunkSystemHooks.scheduleChunkLoad(BaseChunkSystemHooks.java:41) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.server.level.ServerLevel.moonrise$loadChunksAsync(ServerLevel.java:459) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at ca.spottedleaf.moonrise.patches.chunk_system.MoonriseChunkLoadCounter.trackLoadWithRadius(MoonriseChunkLoadCounter.java:32) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.server.network.config.PrepareSpawnTask$Preparing.tick(PrepareSpawnTask.java:235) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.server.network.config.PrepareSpawnTask.tick(PrepareSpawnTask.java:124) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.server.network.ServerConfigurationPacketListenerImpl.tick(ServerConfigurationPacketListenerImpl.java:223) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.network.Connection.tick(Connection.java:597) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.server.network.ServerConnectionListener.tick(ServerConnectionListener.java:264) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.server.MinecraftServer.tickConnection(MinecraftServer.java:1845) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.server.dedicated.DedicatedServer.tickConnection(DedicatedServer.java:552) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1809) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1606) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.server.dedicated.DedicatedServer.tickServer(DedicatedServer.java:430) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1326) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:366) ~[paper-1.21.10.jar:1.21.10-73-b57d641]
	at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
[22:01:02 INFO]: Kopo942 (25f5129d-2f02-4e1e-81e5-1e28481017a0) lost connection: Unexpected error during configuration
[22:01:08 INFO]: UUID of player Kopo942 is 25f5129d-2f02-4e1e-81e5-1e28481017a0
[22:02:05 WARN]: [spark] Timed out waiting for world statistics
[22:03:05 WARN]: [spark] Timed out waiting for world statistics
[22:04:05 WARN]: [spark] Timed out waiting for world statistics
[22:04:10 INFO]: UUID of player Kopo942 is 25f5129d-2f02-4e1e-81e5-1e28481017a0
[22:05:05 WARN]: [spark] Timed out waiting for world statistics

Paper version

This server is running Paper version 1.21.10-73-main@b57d641 (2025-10-14T18:31:11Z) (Implementing API version 1.21.10-R0.1-SNAPSHOT)
You are running the latest version

Other

Related to #13023, hopefully fixed by #13076

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the teleport() and teleportAsync() reproduction in the issue, then trace the reported failure through PrepareSpawnTask and the chunk-system classes in the stack trace. Compare the behavior with related issues #13023 and #13076, and reproduce the restart-and-join case. Done means out-of-bounds teleportation no longer crashes or soft-locks the server.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.