Skip to content

Critical error on first join (new players) on Folia 1.21.8 #217

@yousefjaser2020

Description

@yousefjaser2020

Terms

  • I'm using the very latest version of zEssentials and its dependencies (zMenu and PlaceholdersAPI).
  • I am sure this is a bug and it is not caused by a misconfiguration or by another plugin.
  • I've looked for already existing issues on the Issue Tracker and haven't found any.
  • I already searched on the plugin wiki to know if a solution is already known.
  • I already searched on the discord to check if anyone already has a solution for this.
  • I tested this with just zEssentials and its dependencies and with a vanilla client of the same version as the Server.
  • I enabled the debug mode in config.yml and sql debug

Discord Username (optional)

6q_.

Server Version

1.21.4

Server Software

[00:18:22 INFO]: Checking version, please wait...
[00:18:22 INFO]: This server is running Folia version 1.21.8-6-ver/1.21.8@612d9bd (2025-09-30T14:11:15Z) (Implementing API version 1.21.8-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.11-6-0795007 (MC: 1.21.11)

zEssentials Version

/version zEssentials
[00:19:22 INFO]: zEssentials version 1.0.3.0
Provides an essential, core set of commands for Bukkit.
Website: https://groupez.dev/
Author: [Maxlego08]
Contributors: Louis_Dew, Traqueur, JavaToastDev, Melon-Oof, alwyn974, Mapacheee, and NeiiZun

zMenu Version

/version zMenu
[00:19:37 INFO]: zMenu version 1.1.0.5
Inventory management plugin
Website: https://groupez.dev/resources/zmenu.253
Author: Maxlego08
Contributors: mani1232, lijinhong11, Adreez, EnzoShoes, Noltox, saildrag, alwyn974, and 1robie

What happened?

Hello zEssentials support team,

I’m experiencing a critical issue with zEssentials v1.0.3.0 on Folia 1.21.8.

When a brand-new player joins the server for the first time (never joined before), the server throws an error during PlayerJoinEvent.

This happens consistently on first join.

Environment:

  • Server: Folia 1.21.8
  • Plugin: zEssentials v1.0.3.0
  • Java: 21

Error:

java.lang.IllegalStateException: Player is already removed from player chunk loader

Stacktrace shows:

  • PlayerJoinEvent
  • zEssentials PlayerListener.onJoin
  • FoliaImplementation.teleportAsync
  • Entity.teleportAsync
  • ServerPlayer.transformForAsyncTeleport
  • removePlayerImmediately

It looks like teleportAsync is being executed during PlayerJoinEvent for new players, which causes Folia to remove the player from the chunk system and then fail when the player is handled again.

The issue does not appear to be player-specific and happens for every first-time join.

Please let me know:

  • If this is a known Folia issue
  • Or if there is a recommended configuration or fix to avoid teleporting players during the join lifecycle on Folia

Thank you for your time and support.

Steps to reproduce the issue

  1. Install Folia 1.21.8 (fresh server, no existing player data).
  2. Start the server once, then stop it.
  3. Install zEssentials, zMenu, PlaceholderAPI, Vault.
  4. Start the server.
  5. Join the server with a brand-new player (a player that has never joined this server before, with no existing player data).
  6. As soon as the player finishes joining (during PlayerJoinEvent), the following error appears in the console:
Could not pass event PlayerJoinEvent to zEssentials v1.0.3.0
java.lang.IllegalStateException: Player is already removed from player chunk loader
...
at fr.maxlego08.essentials.listener.PlayerListener.onJoin(PlayerListener.java:193)
at fr.maxlego08.essentials.libs.folialib.impl.FoliaImplementation.teleportAsync(...)
at org.bukkit.entity.Entity.teleportAsync(...)

Expected result

New players should be able to join the server normally without any errors.

Actual result

When a new player joins for the first time, zEssentials throws an exception during PlayerJoinEvent (appears to be related to using teleportAsync on Folia).

Full Server Log

https://mclo.gs/eTnjXEG

Error (optional)

[00:17:10 INFO]: UUID of player P3ruCob is f6854365-7d26-3fa6-b022-76ba444f1c21
[00:17:10 INFO]: [HorriblePlayerLoginEventHack] You have plugins listening to the PlayerLoginEvent, this will cause re-configuration APIs to be unavailable: [LuckPerms, zEssentials, Maintenance, ProtocolLib, WorldGuard]
[00:17:10 INFO]: [zEssentials] P3ruCob (f6854365-7d26-3fa6-b022-76ba444f1c21) is a new player !
[00:17:14 ERROR]: Could not pass event PlayerJoinEvent to zEssentials v1.0.3.0
java.lang.IllegalStateException: Player is already removed from player chunk loader
        at ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.removePlayer(RegionizedPlayerChunkLoader.java:221) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at ca.spottedleaf.moonrise.paper.util.BaseChunkSystemHooks.removePlayerFromDistanceMaps(BaseChunkSystemHooks.java:176) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.server.level.ChunkMap.updatePlayerStatus(ChunkMap.java:886) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.server.level.ChunkMap.removeEntity(ChunkMap.java:984) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.server.level.ServerChunkCache.removeEntity(ServerChunkCache.java:749) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.server.level.ServerLevel$EntityCallbacks.onTrackingEnd(ServerLevel.java:2873) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.server.level.ServerLevel$EntityCallbacks.onTrackingEnd(ServerLevel.java:2748) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup.entityStatusChange(EntityLookup.java:304) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup$EntityCallback.onRemove(EntityLookup.java:1001) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.world.entity.Entity.setRemoved(Entity.java:5983) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.world.entity.Entity.remove(Entity.java:732) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.world.entity.LivingEntity.remove(LivingEntity.java:763) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.world.entity.player.Player.remove(Player.java:1424) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.server.level.ServerLevel.removePlayerImmediately(ServerLevel.java:1710) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.server.level.ServerPlayer.transformForAsyncTeleport(ServerPlayer.java:1694) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.server.level.ServerPlayer.transformForAsyncTeleport(ServerPlayer.java:196) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.world.entity.Entity.teleportAsync(Entity.java:4366) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at org.bukkit.craftbukkit.entity.CraftEntity.lambda$teleportAsync$5(CraftEntity.java:1135) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at org.bukkit.craftbukkit.entity.CraftEntity.teleportAsync(CraftEntity.java:1150) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at org.bukkit.entity.Entity.teleportAsync(Entity.java:239) ~[folia-api-1.21.8-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.entity.Entity.teleportAsync(Entity.java:226) ~[folia-api-1.21.8-R0.1-SNAPSHOT.jar:?]
        at zEssentials-1.0.3.0 (4).jar/fr.maxlego08.essentials.libs.folialib.impl.FoliaImplementation.teleportAsync(FoliaImplementation.java:509) ~[zEssentials-1.0.3.0 (4).jar:?]
        at zEssentials-1.0.3.0 (4).jar/fr.maxlego08.essentials.listener.PlayerListener.onJoin(PlayerListener.java:193) ~[zEssentials-1.0.3.0 (4).jar:?]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[folia-api-1.21.8-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:71) ~[folia-api-1.21.8-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[folia-api-1.21.8-R0.1-SNAPSHOT.jar:?]
        at net.minecraft.server.players.PlayerList.placeNewPlayer(PlayerList.java:418) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.server.network.ServerConfigurationPacketListenerImpl.lambda$handleConfigurationFinished$2(ServerConfigurationPacketListenerImpl.java:216) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at io.papermc.paper.threadedregions.RegionizedTaskQueue$PrioritisedQueue$ChunkBasedPriorityTask.executeInternal(RegionizedTaskQueue.java:515) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at io.papermc.paper.threadedregions.RegionizedTaskQueue$PrioritisedQueue.executeTask(RegionizedTaskQueue.java:442) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at io.papermc.paper.threadedregions.RegionizedTaskQueue$RegionTaskQueueData.drainTasks(RegionizedTaskQueue.java:271) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1645) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at io.papermc.paper.threadedregions.TickRegions$ConcreteRegionTickHandle.tickRegion(TickRegions.java:407) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at io.papermc.paper.threadedregions.TickRegionScheduler$RegionScheduleHandle.runTick(TickRegionScheduler.java:418) ~[folia-1.21.8.jar:1.21.8-6-612d9bd]
        at ca.spottedleaf.concurrentutil.scheduler.SchedulerThreadPool$TickThreadRunner.run(SchedulerThreadPool.java:546) ~[concurrentutil-0.0.3.jar:?]
        at java.base/java.lang.Thread.run(Thread.java:1474) ~[?:?]
[00:17:14 INFO]: P3ruCob has made the advancement [Isn't It Iron Pick]
[00:17:14 INFO]: P3ruCob[/94.73.30.72:55911] logged in with entity id 321 at ([world]3.5, 64.0, -0.5)
[00:18:13 INFO]: UUID of player zYousef is 5a192726-7a8d-397a-95ad-94832fea44dc
[00:18:14 INFO]: zYousef[/94.73.30.72:53505] logged in with entity id 502 at ([world]-4132.973971615704, 63.0, 3281.699999988079)
[00:18:15 INFO]: [voicechat] Received secret request of zYousef (20)
[00:18:15 INFO]: [voicechat] Sent secret to zYousef
/version
[00:18:22 INFO]: Checking version, please wait...
[00:18:22 INFO]: This server is running Folia version 1.21.8-6-ver/1.21.8@612d9bd (2025-09-30T14:11:15Z) (Implementing API version 1.21.8-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.11-6-0795007 (MC: 1.21.11)
[00:19:04 INFO]: zYousef issued server command: /version zEssentials

Other files, you can drag and drop them here to upload. (optional)

my zEss Config
myZessConfig.tar.gz

Screenshots/Videos (you can drag and drop files or paste links)

Image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions