mojira.dev
MC-275621

Pick blocking a block in survival mode crashes the server if the block is in the player's inventory

when pickblocking a block, the server crashes due to io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:set_player_inventory' if the block the player pickblocks is in their inventory. this happens on single player as well.

how to replicate bug:

  1. Put any block in the player inventory in survival mode

  2. pick block the same type of block

demonstration of bug:

https://drive.google.com/file/d/1Id1FKlQtB_QbitWgMkmZ03GOoLqZ-XfS/view?usp=drive_link

relevant stack trace from log file:
[13:19:30] [Netty Server IO #1/ERROR]: Error sending packet clientbound/minecraft:set_player_inventory
io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:set_player_inventory'
    at za.a(SourceFile:55) ~[24w33a.jar:?]
    at za.encode(SourceFile:14) ~[24w33a.jar:?]
    at wi.a(SourceFile:26) ~[24w33a.jar:?]
    at wi.encode(SourceFile:12) ~[24w33a.jar:?]
    at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ~[netty-codec-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:113) ~[netty-codec-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.ChannelOutboundHandlerAdapter.write(ChannelOutboundHandlerAdapter.java:113) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at vx$2.write(SourceFile:530) ~[24w33a.jar:?]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:940) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:966) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:934) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:984) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1025) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:306) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at vx.c(SourceFile:350) ~[24w33a.jar:?]
    at vx.d(SourceFile:345) ~[24w33a.jar:?]
    at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) ~[netty-common-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167) ~[netty-common-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) ~[netty-common-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) ~[netty-transport-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.97.Final.jar:4.1.97.Final]
    at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
Caused by: io.netty.handler.codec.EncoderException: Empty ItemStack not allowed
    at cvl$2.a(SourceFile:176) ~[24w33a.jar:?]
    at cvl$2.encode(SourceFile:163) ~[24w33a.jar:?]
    at zb$12.encode(SourceFile:157) ~[24w33a.jar:?]
    at zb$9.a(SourceFile:97) ~[24w33a.jar:?]
    at zb$9.encode(SourceFile:87) ~[24w33a.jar:?]
    at za.a(SourceFile:53) ~[24w33a.jar:?]
    ... 31 more

 

based on this, it looks like there is something causing an ItemStack object to be set as empty as the parameter of a function.

Linked issues

Comments 1

Thank you for your report!
We're tracking this issue in MC-275293, so this ticket is being resolved and linked as a duplicate.

If you would like to add a vote and any extra information to the main ticket it would be appreciated.

If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

dlsOyes

(Unassigned)

Unconfirmed

(Unassigned)

24w33a

Retrieved