From 3396400dda1ca3e443bbffdc0d41fe992c938a2f Mon Sep 17 00:00:00 2001 From: Flegma Date: Tue, 21 Jul 2026 03:44:48 +0200 Subject: [PATCH] fix(steam-match-history): surface Steam 412 as an actionable share-code hint Steam returns 412 Precondition Failed from GetNextMatchSharingCode when the knowncode is not a valid share code for the account: a stale seed from an old link, or a wrong code pasted at link time. fetchNextShareCode previously dropped 412 into the generic status string, which surfaces both in the Linked Accounts Last error line (pollForUser) and inline at link time (the linkAccount probe), so the user only saw a raw status code with no idea how to recover. Special-case 412 next to the existing 403/202/429 handling and return a context-neutral, actionable message (share code not accepted, link again with your most recent share code). It reads correctly from both callers, matching the neutral 403/429 strings, and points the user at the fix. Re-linking overwrites last_known_share_code via on_conflict, clearing the stuck state. --- .../steam-match-history.service.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/steam-match-history/steam-match-history.service.ts b/src/steam-match-history/steam-match-history.service.ts index 15a6e9d0..4c706417 100644 --- a/src/steam-match-history/steam-match-history.service.ts +++ b/src/steam-match-history/steam-match-history.service.ts @@ -389,6 +389,18 @@ export class SteamMatchHistoryService { if (response.status === 403) { return { nextCode: null, error: "invalid auth_code or share_code" }; } + if (response.status === 412) { + // Steam returns 412 when the knowncode is not a valid share code for + // this account: a stale seed on the pollForUser walk, or a wrong code + // pasted into the linkAccount probe. fetchNextShareCode serves both + // callers, so keep this message context-neutral and actionable rather + // than the raw "responded with 412". + return { + nextCode: null, + error: + "share code not accepted, link again with your most recent share code", + }; + } if (response.status === 202) { return { nextCode: null, error: null }; }