From b828fa17de042251e0c0f50b1bc57ac5c225bebd Mon Sep 17 00:00:00 2001 From: "Calum H." Date: Wed, 10 Jun 2026 14:28:00 +0100 Subject: [PATCH] feat(app-auth): add new error cases to mc auth error modal (#6349) --- .../MinecraftAuthErrorModal.vue | 4 +- .../minecraft-auth-errors.ts | 112 +++++++++++++++++- apps/app-frontend/src/store/error.js | 5 +- 3 files changed, 117 insertions(+), 4 deletions(-) diff --git a/apps/app-frontend/src/components/ui/minecraft-auth-error-modal/MinecraftAuthErrorModal.vue b/apps/app-frontend/src/components/ui/minecraft-auth-error-modal/MinecraftAuthErrorModal.vue index 2b1b79f65..40267f14f 100644 --- a/apps/app-frontend/src/components/ui/minecraft-auth-error-modal/MinecraftAuthErrorModal.vue +++ b/apps/app-frontend/src/components/ui/minecraft-auth-error-modal/MinecraftAuthErrorModal.vue @@ -14,7 +14,7 @@ import { hide_ads_window, show_ads_window } from '@/helpers/ads.js' import { login as login_flow, set_default_user } from '@/helpers/auth.js' import { handleSevereError } from '@/store/error.js' -import { type MinecraftAuthError, minecraftAuthErrors } from './minecraft-auth-errors' +import { findMinecraftAuthError, type MinecraftAuthError } from './minecraft-auth-errors' const modal = ref>() const rawError = ref('') @@ -26,7 +26,7 @@ const loadingSignIn = ref(false) function show(errorVal: { message?: string }) { rawError.value = errorVal?.message ?? String(errorVal) - matchedError.value = minecraftAuthErrors.find((e) => rawError.value.includes(e.errorCode)) ?? null + matchedError.value = findMinecraftAuthError(rawError.value) debugCollapsed.value = true hide_ads_window() diff --git a/apps/app-frontend/src/components/ui/minecraft-auth-error-modal/minecraft-auth-errors.ts b/apps/app-frontend/src/components/ui/minecraft-auth-error-modal/minecraft-auth-errors.ts index 5e33d7aaa..b1205b270 100644 --- a/apps/app-frontend/src/components/ui/minecraft-auth-error-modal/minecraft-auth-errors.ts +++ b/apps/app-frontend/src/components/ui/minecraft-auth-error-modal/minecraft-auth-errors.ts @@ -1,10 +1,93 @@ export interface MinecraftAuthError { - errorCode: string + errorCode?: string + errorMatchers?: string[] + matches?: (message: string) => boolean whatHappened: string stepsToFix: string[] } export const minecraftAuthErrors: MinecraftAuthError[] = [ + { + errorMatchers: ['Failed to deserialize response to JSON during step RefreshOAuthToken:'], + whatHappened: + 'Your saved Microsoft sign-in token has expired or was revoked, so Modrinth App cannot refresh your Minecraft session.', + stepsToFix: [ + 'Sign out of the affected Minecraft account in Modrinth App', + 'Sign in to the account again', + 'Once the new sign-in finishes, try launching Minecraft again', + ], + }, + { + errorMatchers: ['Failed to deserialize response to JSON during step SisuAuthenticate:'], + whatHappened: + 'Xbox services rejected the first sign-in response. This is most often caused by your system clock or time zone being out of sync.', + stepsToFix: [ + 'Open your system date and time settings', + 'Turn on automatic time zone and automatic time, if available', + 'Use the sync option in your system settings to synchronize the clock', + 'Restart Modrinth App', + 'Try signing in again', + ], + }, + { + matches: (message) => + message.includes('Failed to deserialize response to JSON during step MinecraftToken:') && + message.includes('429 Too Many Requests'), + whatHappened: + 'Microsoft or Minecraft temporarily blocked the sign-in request because there were too many recent attempts.', + stepsToFix: [ + 'Wait about an hour before trying again', + 'Restart Modrinth App after waiting', + 'Try signing in once more', + 'If the same message appears, wait longer before retrying so the temporary limit can clear', + ], + }, + { + matches: (message) => + message.includes('Failed to deserialize response to JSON during step MinecraftToken:') && + /Status Code: 5\d\d/.test(message), + whatHappened: + "Minecraft's authentication service is returning a server error, so Modrinth App cannot finish signing you in right now.", + stepsToFix: [ + 'Wait a few minutes and try signing in again', + 'Check Xbox Status for current service issues', + 'Try signing in with the official Minecraft Launcher to confirm whether Minecraft sign-in is also affected there', + 'If the service is healthy and this keeps happening, contact support with the debug information below', + ], + }, + { + errorMatchers: ['Failed to fetch player profile'], + whatHappened: + 'Minecraft services could not return a Java Edition profile for this account. This most often happens when the game was purchased recently, the Java profile has not finished being created, or the wrong Microsoft account is being used.', + stepsToFix: [ + 'Sign in with the official Minecraft Launcher', + 'Launch Minecraft: Java Edition once from the official launcher', + 'Wait up to an hour if the purchase or profile setup was recent', + 'Make sure you are using the Microsoft account that owns Minecraft. See Finding the right Xbox account for help', + 'Try signing in to Modrinth App again', + ], + }, + { + matches: (message) => + message.includes('error sending request for url (') && + [ + 'minecraft.net', + 'minecraftservices.com', + 'mojang.com', + 'xbox.com', + 'xboxlive.com', + 'live.com', + ].some((domain) => message.includes(domain)), + whatHappened: + 'Modrinth App could not connect to a Microsoft, Xbox, or Minecraft service needed for sign-in. This is usually caused by a local network, DNS, proxy, firewall, hosts file, VPN, or antivirus issue.', + stepsToFix: [ + 'Restart Modrinth App and try signing in again', + 'Check that your internet connection is working', + 'Allow Modrinth App through your firewall, antivirus, proxy, VPN, and hosts file rules', + 'Try a different network or temporarily disable VPN/proxy software if you use one', + 'If routing or DNS is the issue, a service like Cloudflare WARP can sometimes help', + ], + }, { errorCode: '2148916222', whatHappened: @@ -87,4 +170,31 @@ export const minecraftAuthErrors: MinecraftAuthError[] = [ 'Once finished, try signing in again', ], }, + { + errorMatchers: ['Failed to deserialize response to JSON during step XstsAuthorize:'], + whatHappened: + 'Xbox services rejected the request to authorize this account for Minecraft services, but did not return a specific account restriction that Modrinth App recognizes.', + stepsToFix: [ + 'Sign in with the official Minecraft Launcher', + 'Complete any prompts shown by Microsoft, Xbox, or Minecraft', + 'Try signing in to Modrinth App again', + 'If the official launcher also fails, follow the error shown there or contact Xbox Support', + ], + }, ] + +export function findMinecraftAuthError(message: string): MinecraftAuthError | null { + return ( + minecraftAuthErrors.find((error) => { + if (error.errorCode && message.includes(error.errorCode)) { + return true + } + + if (error.errorMatchers?.some((matcher) => message.includes(matcher))) { + return true + } + + return error.matches?.(message) ?? false + }) ?? null + ) +} diff --git a/apps/app-frontend/src/store/error.js b/apps/app-frontend/src/store/error.js index dfec21120..481d48d19 100644 --- a/apps/app-frontend/src/store/error.js +++ b/apps/app-frontend/src/store/error.js @@ -1,5 +1,7 @@ import { defineStore } from 'pinia' +import { findMinecraftAuthError } from '@/components/ui/minecraft-auth-error-modal/minecraft-auth-errors' + export const useError = defineStore('errorsStore', { state: () => ({ errorModal: null, @@ -15,7 +17,8 @@ export const useError = defineStore('errorsStore', { showError(error, context, closable = true, source = null) { if ( error.message && - error.message.includes('Minecraft authentication error:') && + (error.message.includes('Minecraft authentication error:') || + findMinecraftAuthError(error.message)) && this.minecraftAuthErrorModal ) { this.minecraftAuthErrorModal.show(error)