Error while reading a message from server. | Index was out of range.
Disclaimers
- [X] I have searched the issue tracker to check if the issue has already been reported.
- [X] My issue happened while using mods.
What happened?
Error while trying to connect.
Reproduction steps
- Join a server
Bug prevalence
Just once
Version
0.18.15.1 / 0.18.15.2 on macOS
-
No response
Which operating system did you encounter this bug on?
Windows
Relevant error messages and crash reports
Error while reading a message from server. {Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')}
at Barotrauma.MultiPlayerCampaign.ClientRead(IReadMessage msg)
at Barotrauma.Networking.GameClient.ReadLobbyUpdate(IReadMessage inc)
at Barotrauma.Networking.GameClient.ReadDataMessage(IReadMessage inc)
at Barotrauma.Networking.SteamP2PClientPeer.Update(Single deltaTime)
at Barotrauma.Networking.GameClient.Update(Single deltaTime)
This is common when joining a server with very many mods and if you haven't enable the mods which server have enabled. but i cannot find how to produce it too.
Can happen vanilla too.
We got a new report that seems to be about the same issue. The crash report in that one also includes line numbers:
Error while reading a message from server, {Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')} at Barotrauma.MultiplayerCampaign.ClientRead(IReadMessage msg) in <DEV>\Barotrauma(BarotraumaClient\ClientSource\GameSession\GameModes\MultiPlayerCampaign.cs:line 699 at Barotrauma.Networking.GameClient.ReadLobbyUpdate(lReadMessage inc) in <DEV>\BarotraumalBarotraumaClient\ClientSourcelNetworking\GameClient.cs:line 2007 at Barotrauma.Networking.GameClient.ReadDataMessage(lReadMessage inc) in <DEV>\BarotraumalBarotraumaClient\ClientsNetworking\GameClient.cs:line 624 at Barotrauma.Networking.SteamP2PClientPeer.Update(Single deltaTime) in <DEV>\BarotraumalBarotraumaClient\ClientSourcelNetworking\Primitives\Peers\SteamP2pClientPeer.cs:line 260 at Barotrauma.Networking.GameClient.Update(Single deltaTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Networking\GameClient.cs:line 477
Added a more descriptive error message that should make this easier to diagnose https://github.com/Regalis11/Barotrauma-development/commit/8dfe3de03f1034fd03987e7a03b5b82942a107b4, + prevented this from crashing the game