[SPIGOT-6908] "Entity {...} is not in the region" server crash loop Created: 22/Jan/22  Updated: 22/Jan/22  Resolved: 22/Jan/22

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Nathan Wolf Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Environment:

Ubuntu


Issue Links:
Duplicate
duplicates SPIGOT-6891 Crash when importing 1.17 chunks with... Resolved
Version:  CraftBukkit version 3408-Spigot-f4ff00f-74a5cc8 (MC: 1.18.1)
Guidelines Read: Yes

 Description   

My server has some chunks that will crash the server when they load. This seems to be due to an entity that is outside of the region with a very high Y-value.

 

java.lang.IllegalStateException: Entity EntityWitherSkull['Wither Skull'/811, l='ServerLevel[world]', x=-4464.26, y=2560.84, z=-2255.58] is not in the region	at com.google.common.base.Preconditions.checkState(Preconditions.java:590) ~[guava-31.0.1-jre.jar:?]	at org.bukkit.craftbukkit.v1_18_R1.generator.CraftLimitedRegion.saveEntities(CraftLimitedRegion.java:98) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]

 

I can not reproduce this problem from scratch, this server is very old so it's possible that this entity has been there since prior versions of MC/Spigot that did not have this check?

I also can't identify the faulty region files, but if you do need a repro case and can help me map those x/z coordinates to a region file, I'm happy to attach it!

It seems odd I have never seen this before, but since updating to 1.18 my server crashes every few days, when certain players try to log in and these broken chunks load. I looked through git history and the check doesn't seem that new, so I'm confused as to what's going on- something to do with the world height change, I'm guessing?

The check it's hitting specifically is from CraftLimitedRegion, here:

 

if (entity.isAlive()) {
    // check if entity is still in region or if it got teleported outside it
    Preconditions.checkState(region.contains(entity.getX(), entity.getY(), entity.getZ()), "Entity %s is not in the region", entity);
    access.addFreshEntity(entity);
}

 

Would it be possible to skip saving the entity in this case, rather than hard-crashing the server?

Full stack trace - most of this will repeat several times before the server shuts down.

[17:15:54] [Server thread/FATAL]: Error executing task on Chunk source main thread executor for minecraft:overworldnet.minecraft.ReportedException: Exception generating new chunk	at net.minecraft.server.level.PlayerChunkMap.lambda$29(PlayerChunkMap.java:653) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:151) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.server.level.ChunkProviderServer$b.c(ChunkProviderServer.java:634) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.util.thread.IAsyncTaskHandler.y(SourceFile:125) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.server.level.ChunkProviderServer$b.y(ChunkProviderServer.java:645) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:134) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.server.level.ChunkProviderServer.a(ChunkProviderServer.java:163) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.level.World.a(World.java:283) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.level.IWorldReader.a(SourceFile:140) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.level.World.d(World.java:277) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.level.World.l(World.java:272) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.level.World.b_(World.java:609) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.entity.Entity.l(Entity.java:1325) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.entity.Entity.an(Entity.java:573) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.entity.EntityLiving.an(EntityLiving.java:388) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.entity.Entity.k(Entity.java:539) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.entity.EntityLiving.k(EntityLiving.java:2766) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.entity.player.EntityHuman.k(EntityHuman.java:260) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.server.level.EntityPlayer.l(EntityPlayer.java:621) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.server.network.PlayerConnection.b(PlayerConnection.java:299) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.network.NetworkManager.a(NetworkManager.java:250) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.server.network.ServerConnection.c(ServerConnection.java:172) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1322) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:428) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1206) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1034) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at java.lang.Thread.run(Thread.java:833) [?:?]Caused by: java.lang.IllegalStateException: Entity EntityWitherSkull['Wither Skull'/811, l='ServerLevel[world]', x=-4464.26, y=2560.84, z=-2255.58] is not in the region	at com.google.common.base.Preconditions.checkState(Preconditions.java:590) ~[guava-31.0.1-jre.jar:?]	at org.bukkit.craftbukkit.v1_18_R1.generator.CraftLimitedRegion.saveEntities(CraftLimitedRegion.java:98) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.level.chunk.ChunkGenerator.applyBiomeDecoration(ChunkGenerator.java:388) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.level.chunk.ChunkGenerator.a(ChunkGenerator.java:369) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.level.chunk.ChunkStatus.lambda$11(ChunkStatus.java:148) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.world.level.chunk.ChunkStatus.a(ChunkStatus.java:273) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.server.level.PlayerChunkMap.lambda$26(PlayerChunkMap.java:638) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at com.mojang.datafixers.util.Either$Left.map(Either.java:38) ~[datafixerupper-4.0.26.jar:?]	at net.minecraft.server.level.PlayerChunkMap.lambda$25(PlayerChunkMap.java:636) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150) ~[?:?]	at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]	at net.minecraft.server.level.ChunkTaskQueueSorter.b(SourceFile:58) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.util.thread.ThreadedMailbox.g(SourceFile:91) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.util.thread.ThreadedMailbox.a(SourceFile:146) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at net.minecraft.util.thread.ThreadedMailbox.run(SourceFile:102) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395) ~[?:?]	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?]	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?]	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?]	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?]	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?][1

I can attach the full logs if needed, I would have to sanitize IPs and such.

I am not the only one having this issue, but it must be rare as I can't find anything here or via Google.

Thank you for any help you can give! 


Generated at Wed Apr 02 10:57:30 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.