PacketEvents 2.0 failed to inject randomly
Describe the bug Randomly players while joining will get kicked with "PacketEvents 2.0 failed to inject"
Software brand Paper 1.20.4, paper 1.21 (this issue has been around a long time, since 2024-02-10 until present day)
Plugins Protocollib, vulcan, grim
How To Reproduce Randomly players will get disconnected when joining, its quite rare so hard to replicate, it has happened 191 times on my server out of ~150,000 player joins, here is a dump of all https://pastebin.com/GqBE0v0z
I assume this is because there is some kind of conflict/data race between protocollib, the shaded packet events in grim and the old shaded packet events in vulcan?
Expected behavior Shouldn't kick them
Additional context What causes this error? Is there some way to make packet events more fault tolerant rather than just kicking?, maybe some debug flag to println that I could enable and if it happens report back the debug data?
Your having the same issue, eh? It's not rare for me though. It happens every time anyone tries to join.
I am also getting this error every single time on 2.6.0 with Purpur 1.21.1.
Actually updating Better Chat Bubbles to the latest version fixed this for me just now.
@SergioK29 are there any other errors? do you have any other plugins installed? also see the comments above, they may solve your issue
@SergioK29 are there any other errors? do you have any other plugins installed? also see the comments above, they may solve your issue
there is actually one other plugin which touches netty besides plib, vulcan and grim, I have freedom chat but its on latest version so 🤷
same error for me
this is happening for me as well, only packetevents causes this error. Server has ViaVersion and ViaBackwards (goes down as 1.19), runs on 1.20.4 latest purpur. It only kicks some players on join, and it even prevents them from joining the 2nd time sometimes. Is there any way we can find out what causes this?
private void onPlayerLogin( Connection connection, ServerPlayer player, CommonListenerCookie cookie, CallbackInfo ci ) { PacketEventsAPI<?> api = PacketEvents.getAPI();
User user = api.getPlayerManager().getUser(player);
if (user == null) {
Object channelObj = api.getPlayerManager().getChannel(player);
// Check if it's a fake connection
if (!FakeChannelUtil.isFakeChannel(channelObj) &&
(!api.isTerminated() || api.getSettings().isKickIfTerminated())) {
// Kick the player if they're not a fake player
player.connection.disconnect(Component.literal("PacketEvents 2.0 failed to inject"));
}
return;
}
api.getEventManager().callEvent(new UserLoginEvent(user, player));
} erm
+1
plugin list
Getting this randomly too, have to restart the server to fix it. 1.21.4 and 1.21.5, AxiomPaper, GrimAC, ViaVersion(Backwards/Rewind)
Getting this randomly too, have to restart the server to fix it. 1.21.4 and 1.21.5, AxiomPaper, GrimAC, ViaVersion(Backwards/Rewind)
Most likely this is done by AxiomPaper or ProtocolLib
How do you debug why PacketEvents failed to inject? there's no logs other than being kicked. Removing any of the plugins fixes the issue, but Axiom doesn't use Packet Events.
Since I own a network of 1500 onlines and sell a well used plugin using PacketEvents I experienced this a lot too.
My suggestion is to completely ignore the phase of setting the Player object, it seems that both the bukkit events are not reliable enough and Player object is not truly needed to make PE work
I think we can:
- Keep current behavior but quietly ignore spigot event failures
- Retrieve the Player object on demand using
Bukkit#getPlayer(UUID)maybe through a getter that assigns the returned instance if the stored one wasn't set previously - both the things and we all are happy
Experiencing the same problem. Very often on server switch, when doing /hub, PacketEvents kicks them saying it failed to inject. Bump
Same issue.
BUMP
Bump
Same issue on 1.8.8. I am using PacketEvents for GrimAC.
Why not allow the player but re-inject later?
Bump
bump
bump
Bump
Since I own a network of 1500 onlines and sell a well used plugin using PacketEvents I experienced this a lot too.
My suggestion is to completely ignore the phase of setting the Player object, it seems that both the bukkit events are not reliable enough and Player object is not truly needed to make PE work
I think we can:
- Keep current behavior but quietly ignore spigot event failures
- Retrieve the Player object on demand using
Bukkit#getPlayer(UUID)maybe through a getter that assigns the returned instance if the stored one wasn't set previously- both the things and we all are happy
This is the best approach
Why not allow the player but re-inject later?
We'll consider enabling this as an option. We could allow individuals to opt in for re-injection.
If the 'failed to inject' message is frequent, then there's an evident incompatibility between PacketEvents and another plugin. But if it occurs rarely, then it means that PacketEvents recognized a specific player has joined but failed to process any of their packets. Plugins that specifically try to process early packets may no longer function correctly with this option.
In my case I had to switch to "GrimAC Lite" which is only available for Grim Lightning, the pre-release testing version of GrimAC, because Grim will always use it's bundled fork of PacketEvents even when one is installed on the server as a plugin, but lite does not include a bundled version and instead relies on the plugin.
If the injection happens when a player connects I don't see why trying to re-attempt to inject again after the player re-joins from being kicked the first time would cause any issues, maybe re-attempting on the same login without kicking would lead to issues, but as it stands it does not ever try to re-attempt until the server is restarted.
If anyone here still experiences these problems, please try using https://github.com/retrooper/packetevents/actions/runs/15746891009?pr=1251
If anyone here still experiences these problems, please try using https://github.com/retrooper/packetevents/actions/runs/15746891009?pr=1251
Same issue!
[08:36:38 INFO]: LinsaFTW lost connection: PacketEvents 2.0 failed to inject
[08:36:40 INFO]: UUID of player LinsaFTW is 6e777127-0fa1-3452-a721-7318be135618
[08:36:40 INFO]: LinsaFTW[/127.0.0.1:54911] logged in with entity id 112766 at ([world]8.473296294805461, 71.0, 21.593743856890633)
[08:36:40 INFO]: **Deadd OWNER LinsaFTW joined the server
>version packetevents
[08:36:46 INFO]: packetevents version 2.9.0+92ae95f-SNAPSHOT
I have the same issue where the player is getting kicked for "PacketEvents 2.0 failed to inject". This mostly happens when a player gets sent to the Lobby for me.
If anyone here still experiences these problems, please try using https://github.com/retrooper/packetevents/actions/runs/15746891009?pr=1251
Same issue!
[08:36:38 INFO]: LinsaFTW lost connection: PacketEvents 2.0 failed to inject [08:36:40 INFO]: UUID of player LinsaFTW is 6e777127-0fa1-3452-a721-7318be135618 [08:36:40 INFO]: LinsaFTW[/127.0.0.1:54911] logged in with entity id 112766 at ([world]8.473296294805461, 71.0, 21.593743856890633) [08:36:40 INFO]: **Deadd OWNER LinsaFTW joined the server >version packetevents [08:36:46 INFO]: packetevents version 2.9.0+92ae95f-SNAPSHOT
which server version, which plugins, does this occur on every join or just occasionally?
If anyone here still experiences these problems, please try using https://github.com/retrooper/packetevents/actions/runs/15746891009?pr=1251
Same issue!
[08:36:38 INFO]: LinsaFTW lost connection: PacketEvents 2.0 failed to inject [08:36:40 INFO]: UUID of player LinsaFTW is 6e777127-0fa1-3452-a721-7318be135618 [08:36:40 INFO]: LinsaFTW[/127.0.0.1:54911] logged in with entity id 112766 at ([world]8.473296294805461, 71.0, 21.593743856890633) [08:36:40 INFO]: **Deadd OWNER LinsaFTW joined the server >version packetevents [08:36:46 INFO]: packetevents version 2.9.0+92ae95f-SNAPSHOTwhich server version, which plugins, does this occur on every join or just occasionally?
for me, it happens on FlamePaper 1.8.8, and it just occurs occasionally