Errors related to chat commands (MeCommandMessage) make chat unusable

Description:

When this local error happens, the user of the client on which the error happened can no longer use the chat bar at all, and thus cannot chat. The chat bar stays active but cannot be interacted with, the chat becomes completely unusable until the user rejoins!

The bug started happening a few days ago. I got the first report on Wednesday late afternoon / evening in PST. Since then it has occurred several hundreds or maybe even a thousand times. (this is a low traffic game we are talking about!)

The bug can happen in all games where the default chat is used (not a custom chat).


Repro:

The error seems to happen in the following way:

  • User joins the game
  • The local chat modules make a connection to the general chat channel
  • A chat message is added to the chat
  • Some condition is triggered such that some settings/data entries of the channel/message aren’t set properly yet
  • The local chat command modules try to parse the message
  • The command modules throw errors because some values aren’t properly set, but the module still try to use them

We cannot reproduce this reliably, which probably means it is some race condition where a message is added to the channel before chat settings (or other remote objects/settings) are retrieved.

The following error(s) appears in output, in this case the error seems to happen in the MeCommandMessage all the time (maybe this is the first module that is being called, or maybe this is the only one which doesn’t check for uninitialized message data?):

Error
	Chat.ClientChatModules.MessageCreatorModules.MeCommandMessage:30: bad argument #1 to 'sub' (string expected, got nil)
	Players.<PLAYER>.PlayerScripts.ChatScript.ChatMain	Chat.ClientChatModules.MessageCreatorModules.MeCommandMessage, line 30 - local UpdateTextFunction
	Chat.ClientChatModules.MessageCreatorModules.MeCommandMessage, line 37 - field ? Players.<PLAYER>.PlayerScripts.ChatScript.ChatMain.MessageLabelCreator, line 83 - method CreateMessageLabel
	Players.<PLAYER>.PlayerScripts.ChatScript.ChatMain.MessageLogDisplay, line 80 - method AddMessage Players.<PLAYER>.PlayerScripts.ChatScript.ChatMain.ChatChannel, line 68 - method AddMessageToChannel
	Players.<PLAYER>.PlayerScripts.ChatScript.ChatMain, line 804 - global HandleChannelJoined Players.<PLAYER>.PlayerScripts.ChatScript.ChatMain, line 1031

Error
	Requested module experienced an error while loading	Players.<PLAYER>.PlayerScripts.ChatScript
	Players.<PLAYER>.PlayerScripts.ChatScript, line 15 - local DoEverything Players.<PLAYER>.PlayerScripts.ChatScript, line 130

Full stack trace:

Script 'Players.<PLAYER>.PlayerScripts.ChatScript', Line 15 - local DoEverything
Script 'Players.<PLAYER>.PlayerScripts.ChatScript', Line 130
Script 'Chat.ClientChatModules.MessageCreatorModules.MeCommandMessage', Line 30 - local UpdateTextFunction
Script 'Chat.ClientChatModules.MessageCreatorModules.MeCommandMessage', Line 37 - field ?
Script 'Players.<PLAYER>.PlayerScripts.ChatScript.ChatMain.MessageLabelCreator', Line 83 - method CreateMessageLabel
Script 'Players.<PLAYER>.PlayerScripts.ChatScript.ChatMain.MessageLogDisplay', Line 80 - method AddMessage
Script 'Players.<PLAYER>.PlayerScripts.ChatScript.ChatMain.ChatChannel', Line 68 - method AddMessageToChannel
Script 'Players.<PLAYER>.PlayerScripts.ChatScript.ChatMain', Line 804 - global HandleChannelJoined	nil
Script 'Players.<PLAYER>.PlayerScripts.ChatScript.ChatMain', Line 1031

This is the code at the place of error:

The highlighted part seems to be nil, which is why this error happens. This indicates that somewhere, somehow, something was not properly initialized before the chat messages started rolling in through these command modules.


Player feedback log:

  • “i press the “/” button to chat, and all it does is make the chat bar appear and desapear, clicking does the same result”
  • “I keep pressing “/” and it does nothing. meaning i cant chat”
  • “the chat is broken, it does not get rid of the to chat, click here or press ‘/’ key,”
  • “I cant chat” x50
  • “Chat is broken” x30
  • “game doesn’t let me chat” x5
  • “LET ME CHAT”
3 Likes

Will be looked into when I get back into the office.

Let me know if you need more information to reproduce this bug.

Sorry it’s been a few days without a response.

I know what the issue is. It’s specifically getting the message log when a player joins the server. If there is a /me message in the log it will break. This is because of a bug with the fetching chat log code for the new filter API that was implemented that only checks for default messages to convert instead of /me message as well.

If you want to implement the fix now, at around line 302 of game.Chat.ChatServiceRunner.ChatChannel you can replace the line
if (messageObj.MessageType == ChatConstants.MessageTypeDefault) then
with
if (messageObj.MessageType == ChatConstants.MessageTypeDefault or messageObj.MessageType == ChatConstants.MessageTypeMeCommand) then

1 Like

Thanks for the quick reply and for the explanation on why it happens, I appreciate it. Will implement that temp fix for now!

Status Update: Had the fast flag for the new filtering API in chat turned off. This issue should stop happening in games now and it will be re-enabled in probably a few weeks when the fix comes out.

1 Like