Barotrauma icon indicating copy to clipboard operation
Barotrauma copied to clipboard

Error while reading a message from server. | Index was out of range.

Open Krzeszny opened this issue 3 years ago • 2 comments

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

  1. 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)

Krzeszny avatar Sep 23 '22 20:09 Krzeszny

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.

esirprus avatar Sep 28 '22 12:09 esirprus

Can happen vanilla too.

Ek-Videogames avatar Oct 03 '22 23:10 Ek-Videogames

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

Regalis11 avatar Dec 05 '22 11:12 Regalis11

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

Regalis11 avatar Dec 05 '22 12:12 Regalis11