Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-270679

Clicking on text with run_command can cause EncoderException and will exit to multiplayer menu

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.20.5 Pre-Release 2
    • 1.20.5 Pre-Release 1
    • None
    • Confirmed

      I wanted to create a book with texts that suggests a command to the player when clicked. This is impossible and working as intended according to MC-70317 (yes, I am slightly protesting in this bug report.) To work around this restriction I created a book with text, that when clicked runs a tellraw command, with text that can be clicked, to suggest a command. Clicking on the text in the book will cause the singleplayer world to crash and exit to the multiplayer screen. The ultimate issue seems to be that the command ran is too long which causes the game to crash

      Recreation steps:

      Place a command block with the following command:

      give @p written_book[ written_book_content={ title:"Admin settings", author:"tholleman", pages:[ '[ { "text":"Change spectator duration", "underlined":true, "clickEvent":{ "action":"run_command", "value":\'/tellraw @s [ "", { "text":"Change spectator duration", "underlined":true, "color":"yellow", "hoverEvent":{ "action":"show_text", "contents":[{"text":"click me"}] }, "clickEvent":{ "action":"suggest_command", "value":"/scoreboard players set duration out_of_body.settings " } } ]\' } } ]' ] }]

      Now activate the command block, open the book, and click the text.

      This will result in a crash with the following stack trace in the log:

      Error sending packet serverbound/minecraft:chat_command
      io.netty.handler.codec.EncoderException: Failed to encode packet 'serverbound/minecraft:chat_command'
      	at zi.a(SourceFile:55)
      	at zi.encode(SourceFile:14)
      	at wq.a(SourceFile:32)
      	at wq.encode(SourceFile:12)
      	at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863)
      	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968)
      	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856)
      	at io.netty.channel.ChannelOutboundHandlerAdapter.write(ChannelOutboundHandlerAdapter.java:113)
      	at wj$2.write(SourceFile:500)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:940)
      	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:966)
      	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:934)
      	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:984)
      	at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1025)
      	at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:306)
      	at wj.c(SourceFile:324)
      	at wj.d(SourceFile:319)
      	at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
      	at io.netty.channel.DefaultEventLoop.run(DefaultEventLoop.java:54)
      	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
      	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
      	at java.base/java.lang.Thread.run(Thread.java:1583)
      Caused by: io.netty.handler.codec.EncoderException: String too big (was 263 characters, max 256)
      	at xb.a(SourceFile:38)
      	at wl.a(SourceFile:581)
      	at agy.a(SourceFile:17)
      	at zj$6.encode(SourceFile:42)
      	at zj$9.a(SourceFile:97)
      	at zj$9.encode(SourceFile:87)
      	at zi.a(SourceFile:53)
      	... 24 more 

            Unassigned Unassigned
            tholleman tholleman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: