BeyondDimension/SteamTools · error · HttpRequestException
Failed to obtain badge information status code: {status}
Error message
Failed to obtain badge information status code: {status} What it means
Thrown (as HttpRequestException) when the Steam badge request returns a status code that is neither OK (200) nor the parental-lock code. The message includes the localized 'get badges error' text plus the actual status code so the caller knows exactly what Steam returned.
Source
Thrown at src/BD.WTTS.Client.Plugins.SteamIdleCard/UI/ViewModels/IdleCardPageViewModel.cs:411
var steam_id = SteamLoginState.SteamId.ToString();
(UserIdleInfo, badges, status) = await IdleCard.GetBadgesAsync(steam_id, true);
if (status == HttpStatusCode.Forbidden)
{
var result = await TextBoxWindowViewModel.ShowDialogAsync(new TextBoxWindowViewModel
{
Title = Strings.Idle_NeedParentalPIN,
Placeholder = "PIN CODE",
InputType = TextBoxWindowViewModel.TextBoxInputType.Password,
});
if (!string.IsNullOrEmpty(result))
{
await steamSession.UnlockParental(steam_id, result);
goto GetBadges;
}
throw new ArgumentNullException(Strings.Idle_PIN_NotBeNull);
}
else if (status != HttpStatusCode.OK)
throw new HttpRequestException($"{Strings.Idle_GetBadgesError} status code: {status}");
goto HandleBadges;
HandleBadges:
Badges.Clear();
Badges.Add(badges!);
//await RefreshPrivateGameAppIds(steam_id);
TotalCardsRemaining = 0;
TotalCardsAvgPrice = 0;
badges = badges!.Where(w => w.CardsRemaining != 0);
foreach (var badge in badges)
{
if (IsExcludedApp(badge.AppId))
continue;
TotalCardsAvgPrice += badge.RegularAvgPrice * badge.CardsRemaining;
TotalCardsRemaining += badge.CardsRemaining;View on GitHub (pinned to c16ffa08e0)
Solutions
- If 401/403, re-login to Steam to refresh the session token, then retry the badge fetch.
- If 429, back off and retry after a delay (respect Steam rate limits).
- If 5xx/0, wait and retry — Steam backend or network is temporarily unavailable.
- Surface the status code to the user with guidance (re-login / retry) instead of a raw exception.
Example fix
// before
else if (status != HttpStatusCode.OK)
throw new HttpRequestException($"{Strings.Idle_GetBadgesError} status code: {status}");
// after: typed handling with retry guidance
else if (status != HttpStatusCode.OK)
{
if (status == HttpStatusCode.Unauthorized || status == HttpStatusCode.Forbidden)
throw new HttpRequestException("Steam session expired; please re-login.");
if ((int)status == 429)
throw new HttpRequestException("Rate limited by Steam; retry later.");
throw new HttpRequestException($"{Strings.Idle_GetBadgesError} status code: {status}");
} Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight: ensure the Steam session is still valid before fetching badges.
if (await steamSession.IsSessionValidAsync() != true)
throw new InvalidOperationException("Steam session expired; please re-login.");
// Rate-limit guard: avoid hammering the badges endpoint.
if (DateTime.UtcNow - lastBadgeFetch < TimeSpan.FromSeconds(5))
throw new InvalidOperationException("Badge fetch rate-limited locally; retry shortly."); Try / catch
try { badges = await FetchBadgesAsync(ct); }
catch (HttpRequestException ex) when (ex.Message.Contains("status code"))
{
var code = ExtractStatusCode(ex.Message);
if (code is 401 or 403) { await ReLoginSteamAsync(); goto retry; } // auth expired
if (code == 429 || (int)code >= 500) { await Task.Delay(backoff, ct); goto retry; } // transient
Log.Error($"Steam badge fetch failed: HTTP {code}");
throw;
} Prevention
- Validate the Steam session/login token before each badge fetch and re-login on 401/403.
- Throttle badge requests to avoid 429 rate limiting from Steam.
- Retry transient statuses (429, 5xx) with exponential backoff.
- Surface the status code to the user with concrete guidance (re-login / retry later).
When it happens
Trigger: Calling the badges endpoint and receiving any non-OK, non-parental status — e.g. 401/403 (auth expired), 429 (rate limited), 500/503 (Steam error), or 0 (network failure surfaced as a non-OK code).
Common situations: Steam session/login token expired; rate limited from too many requests; Steam backend temporarily down; region/network blocking the request; account changed causing auth failure.
Related errors
- PIN CODE cannot be empty
- Could not find any IP that can be successfully connected.
- no shared_secret
- no serial_number
AI-assisted analysis of BeyondDimension/SteamTools@c16ffa08e0 (2026-08-13).
Data as JSON: /api/errors/1925cc6dd50a440f.
Report an issue: GitHub.