There has been reports from several trainers that they are experiencing a gym error which is even handing them bans. This error has been been experienced while the players are battling enemy gym.
Players have mentioned that when they are fighting a gym, their avatars goes for a stroll out of the gym range and when the Pokemon spawns near them at that point they are booted out of the game and handed a ban. This ban last for a minimum of 10 minutes.
This soft ban can even turn into a permanent ban when you try to continue battling the gym while the ‘error’ message is shown.
However there is nothing to worry in this matter as there is a way to prevent this (make sure you have strong internet connection).
Go to the ‘settings’ section of your phone and then to privacy and safety > Location > locating method > select GPS, WIFI and Mobile networks. Doing this will make the GPS accuracy of your device much better than before and help you to stay away from the bans.
Hope this was helpful. Cheers! (Thanks, Otakukart)