You may try to connect to servers or join up on LAN world in Minecraft. But then, you find there is a message which says that you failed to login because of invalid session. In addition, this message is also followed with a statement that you have to try restarting your game. What should we do if we find this problem?
As you are able to read in the error message that the first thing that you have to do to fix this error is to restart your game. As you can see in the error message too that your session ID is invalid. Usually, it happens when you log in to your account and then have a new instance of Minecraft and log in again without closing down the old one. According to a Minecraft player in StackExchange forum, the old session ID is invalidated as soon as the new connection is made. So, it gives you this error when you try to log into a server because it will only have the new session ID. Furthermore, this Minecraft player states that restarting your client is the only way that you can do to get a new session ID because it will wipe out whatever it thinks the new is.
So, you are able to restart your client by quitting the game, closing the launcher and then reopening it. After that, you are able to start the game again. This method should fix your problem.
You can watch some videos on Youtube about it. One of them is a video of Range Wonk entitled [How To Fix] Failed To Login Invalid Session (Try Restarting Your Game) Minecraft Error. In this video, you can see that the reason why he got this error is because when his account has been opened in another session when he tries to connect to the new one.
If you use TLauncher, sometimes you may find this error too. Usually, it can happen when you try to connect to various servers. The problem is that the server data is licensed and checks the player whether he is authorized under Minecraft license or not. If you connect to an unfamiliar server and get an error related to the session, it can mean that the server only works with licensed accounts such as Hypixel. So, what do we have to do? In TLauncher, you have to log in under the Minecraft/ Mojang license in the Accounts menu item. If you do not have a license, you have to find a server which does not check for a license.
If you made your server using a separate server client, the server checks the license of your account by default. To fix it, you are able to disable the license check on the server. You can do that by finding the server.properties file in the server folder and then the online-mode=true line and then you can change it to online-mode=false. Then, you can connect to the server. It can be done for a separate server client. For Aternos and other hostings, you can find such setting menu items in the hosting interface as online-mode, License Check, Cracked Client Access. You have to disable such settings.