Minecraft-Console-Client
Minecraft-Console-Client copied to clipboard
[BUG] Unhandled Exception: KeyNotFoundException
Prerequisites
- [X] I made sure I am running the latest development build
- [X] I tried to look for similar issues before opening a new one
- [X] I have set
debugmessages=truein config to diagnose my issue - [X] I have redacted session tokens and passwords before attaching screenshots
Minecraft Version
1.18.2
Console Client Version
Not latest sadly
Expected Behavior
Catch the exception and not have fatal crash.
Actual Behavior
MCC has crashed for some reason after trying to relog. (with its auto relog module)
Steps to Reproduce the bug
I'm not sure how to reproduce this bug sadly.
Attach screenshot here (If applicable)
No response
Anythings that could help diagnosing the bug
Restarting Minecraft Console Client...
Cached session is invalid or expired.
Unhandled Exception:
System.Collections.Generic.KeyNotFoundException: The given key 'access_token' was not present in the dictionary.
at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x00021] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at MinecraftClient.Protocol.Microsoft.RequestToken (System.String postData) [0x00058] in <b2e887d387e84817ab9b4c527f3b4c9c>:0
at MinecraftClient.Protocol.Microsoft.RefreshAccessToken (System.String refreshToken) [0x00010] in <b2e887d387e84817ab9b4c527f3b4c9c>:0
at MinecraftClient.Protocol.ProtocolHandler.MicrosoftLoginRefresh (System.String refreshToken, MinecraftClient.Protocol.Session.SessionToken& session) [0x00000] in <b2e887d387e84817ab9b4c527f3b4c9c>:0
at MinecraftClient.Program.InitializeClient () [0x000aa] in <b2e887d387e84817ab9b4c527f3b4c9c>:0
at MinecraftClient.Program+<>c__DisplayClass11_0.<Restart>b__0 () [0x0007a] in <b2e887d387e84817ab9b4c527f3b4c9c>:0
at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00017] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x0008d] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x00031] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at System.Threading.ThreadHelper.ThreadStart () [0x0000b] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.Collections.Generic.KeyNotFoundException: The given key 'access_token' was not present in the dictionary.
at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x00021] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at MinecraftClient.Protocol.Microsoft.RequestToken (System.String postData) [0x00058] in <b2e887d387e84817ab9b4c527f3b4c9c>:0
at MinecraftClient.Protocol.Microsoft.RefreshAccessToken (System.String refreshToken) [0x00010] in <b2e887d387e84817ab9b4c527f3b4c9c>:0
at MinecraftClient.Protocol.ProtocolHandler.MicrosoftLoginRefresh (System.String refreshToken, MinecraftClient.Protocol.Session.SessionToken& session) [0x00000] in <b2e887d387e84817ab9b4c527f3b4c9c>:0
at MinecraftClient.Program.InitializeClient () [0x000aa] in <b2e887d387e84817ab9b4c527f3b4c9c>:0
at MinecraftClient.Program+<>c__DisplayClass11_0.<Restart>b__0 () [0x0007a] in <b2e887d387e84817ab9b4c527f3b4c9c>:0
at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00017] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x0008d] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x00031] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
at System.Threading.ThreadHelper.ThreadStart () [0x0000b] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
Device
Laptop
Operating System
Linux
Server Address (If applicable)
No response
Seems like the crash is caused by this line: https://github.com/MCCTeam/Minecraft-Console-Client/blob/708815fe616ac99517261045aad21e4749865e9e/MinecraftClient/Protocol/MicrosoftAuthentication.cs#L72
Ensure the key is exist before retrieving it should prevent it from crashing.
I can confirm however mine isn't a crash, it just doesn't want to authentificate. Sometimes it works sometimes not
This happens when your ip is either blocked or rate limited by Microsoft. Try using a proxy.