Skip to content

Chat Box crashes server when senderId is null for system/server messages #828

Description

@RippleRose

Describe

On Minecraft 1.21.1 with Advanced Peripherals 0.8.0a, a placed Chat Box can crash a dedicated server when it processes a chat message whose ChatMessageRecord.senderId() is null.

The crash occurs inside ChatBoxPeripheral.update() when Advanced Peripherals executes:

message.senderId().toString()

If the message has no associated player UUID, senderId() returns null and the server crashes with a NullPointerException.

This appears to affect server/system-generated chat messages rather than normal player chat.

Error

java.lang.NullPointerException:
Cannot invoke "java.util.UUID.toString()"
because the return value of
"de.srendi.advancedperipherals.common.events.Events$ChatMessageRecord.senderId()"
is null

at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.ChatBoxPeripheral.lambda$update$5(ChatBoxPeripheral.java:538)

The relevant source is effectively:

queueEvent(
    CCEvents.CHAT,
    message.senderId().toString(),
    message.senderName(),
    message.message(),
    message.isHidden(),
    StringUtil.utf8ToByteString(message.message())
);

There is currently no null check before calling .toString().

Observed trigger

On my dedicated server this has reproduced multiple times around server/system-generated chat messages. One particularly clean reproduction occurred immediately after a scheduled restart warning was broadcast:

[26Aug2026 06:17:07.367] [Server thread/INFO] [MinecraftServer]:
[Not Secure] [Server] Server will be restarting in 30 minutes.

[26Aug2026 06:17:07.419] [Server thread/ERROR]:
Encountered an unexpected exception

The crash occurred about 50 ms after the server-generated message.

I have also reproduced the same null-UUID exception on August 28, 2026 at 06:32:09, again at the same Chat Box and same AP code path.

Normal player chat does not appear to trigger the issue.

Steps to reproduce

The exact senderless-message source may depend on the server environment, but the apparent failure condition is:

  1. Run a Minecraft 1.21.1 dedicated NeoForge server.
  2. Install Advanced Peripherals 0.8.0a and CC:Tweaked.
  3. Place an Advanced Peripherals Chat Box.
  4. Use it from a CC:Tweaked computer so chat events are being consumed.
  5. Generate or receive a server/system chat message that has no player UUID associated with it.
  6. Allow the Chat Box to process that message.
  7. The server crashes when ChatBoxPeripheral evaluates message.senderId().toString().

A server-host restart-warning broadcast has reliably triggered this on my server.

Expected behavior

A senderless/server-generated message should not crash the server.

Possible acceptable behaviors would include:

  • queueing the event with an empty/sentinel UUID,
  • exposing the sender UUID as optional/null in an appropriate way,
  • or ignoring chat records that do not contain a sender UUID.

Actual behavior

The Chat Box block entity throws a NullPointerException while ticking, which terminates the Minecraft server.

One affected block:

advancedperipherals:chat_box
Block position: 136, 64, -255

The physical block itself does not appear corrupted. The failure occurs while processing the queued chat record.

Environment

Minecraft:             1.21.1
NeoForge:              21.1.248
Advanced Peripherals:  0.8.0a
CC:Tweaked:            1.120.0
Java:                  21.0.12.x Eclipse Adoptium
Server type:           Dedicated server
Multiplayer:           Yes
OS:                    Linux

Additional information

This does not appear to be a CC:Tweaked Lua error. The exception occurs inside the Advanced Peripherals server-side Chat Box update code before the event can be safely delivered to the computer.

The important failure condition appears to be:

message.senderId() == null

followed by:

message.senderId().toString()

A defensive null check around senderId() in ChatBoxPeripheral.update() should prevent the dedicated-server crash.

I have reproduced the same senderId() == null exception on multiple occasions. I also tested a local mitigation mixin separately; that is not part of Advanced Peripherals and is not required to reproduce the underlying bug. I can attach the full crash report in a follow-up comment/attachment.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions