{"record":{"id":"391cc72808be0762","repo":"JustArchiNET/ArchiSteamFarm","slug":"failed-due-to-error-0-391cc7","errorCode":null,"errorMessage":"Failed due to error: {0}","messagePattern":"Failed due to error: (.+?)","errorType":"exception","errorClass":"HttpRequestException","httpStatus":null,"severity":"error","filePath":"ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs","lineNumber":346,"sourceCode":"\n\t\t\tawait ASF.InventorySemaphore.WaitAsync().ConfigureAwait(false);\n\n\t\t\tObjectResponse<InventoryResponse>? response = null;\n\n\t\t\ttry {\n\t\t\t\tfor (byte i = 0; (i < WebBrowser.MaxTries) && (response?.Content is not { Result: EResult.OK } || !response.StatusCode.IsSuccessCode()); i++) {\n\t\t\t\t\tif ((i > 0) && (rateLimitingDelay > 0)) {\n\t\t\t\t\t\tawait Task.Delay(rateLimitingDelay).ConfigureAwait(false);\n\t\t\t\t\t}\n\n\t\t\t\t\tresponse = await UrlGetToJsonObjectWithSession<InventoryResponse>(request, requestOptions: WebBrowser.ERequestOptions.ReturnClientErrors | WebBrowser.ERequestOptions.ReturnServerErrors | WebBrowser.ERequestOptions.AllowInvalidBodyOnErrors | WebBrowser.ERequestOptions.SteamWafWorkarounds, rateLimitingDelay: rateLimitingDelay).ConfigureAwait(false);\n\n\t\t\t\t\tif (response == null) {\n\t\t\t\t\t\tthrow new HttpRequestException(Strings.FormatErrorObjectIsNull(nameof(response)));\n\t\t\t\t\t}\n\n\t\t\t\t\tif (response.StatusCode.IsClientErrorCode()) {\n\t\t\t\t\t\tthrow new HttpRequestException(Strings.FormatWarningFailedWithError(response.StatusCode), null, response.StatusCode);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (response.StatusCode.IsServerErrorCode()) {\n\t\t\t\t\t\tif (string.IsNullOrEmpty(response.Content?.ErrorText)) {\n\t\t\t\t\t\t\t// This is a generic server error without a reason, try again\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tBot.ArchiLogger.LogGenericDebug(Strings.FormatWarningFailedWithError(response.Content.ErrorText));\n\n\t\t\t\t\t\t// Try to interpret the failure reason and see if we should try again\n\t\t\t\t\t\tswitch (response.Content.ErrorCode) {\n\t\t\t\t\t\t\tcase EResult.Busy:\n\t\t\t\t\t\t\tcase EResult.DuplicateRequest:\n\t\t\t\t\t\t\tcase EResult.Fail:\n\t\t\t\t\t\t\tcase EResult.RemoteCallFailed:\n\t\t\t\t\t\t\tcase EResult.ServiceUnavailable:\n\t\t\t\t\t\t\tcase EResult.Timeout:","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/JustArchiNET/ArchiSteamFarm/blob/fe57c4129f4ce02d452318cabc525eb49a087255/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs#L328-L364","documentation":"Inside the inventory retry loop, if the HTTP response status is a 4xx client error (response.StatusCode.IsClientErrorCode()), ASF throws an HttpRequestException carrying that status code as the inner status. Client errors are treated as non-retryable — the request itself is wrong or unauthorized.","triggerScenarios":"Steam community returns a 4xx (e.g. 401 unauthorized session, 403 forbidden/private inventory, 404 not found, 429 rate-limited occasionally classified here) for the inventory endpoint.","commonSituations":"Expired/invalid access token (401); target inventory set to private (403); wrong profile/inventory URL (404); stale session cookies; the bot account losing web privileges.","solutions":["Refresh the bot's web session / access token and retry.","Confirm the target inventory is public (or owned by the bot).","Verify the constructed inventory URL is correct for the account and app/context.","If 429, reduce request frequency and respect rate limiting."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Refresh session if it is likely stale before a client error surfaces.\nif (sessionLikelyExpired) await bot.ArchiWebHandler.RefreshSession();","typeGuard":null,"tryCatchPattern":"try { await foreach (var a in webHandler.GetInventoryAsync(steamID)) { /* ... */ } }\ncatch (HttpRequestException ex) when (ex.StatusCode.HasValue && (int)ex.StatusCode.Value is >= 400 and <= 499) {\n    // 4xx client error; refresh session or correct target, do not blind-retry\n}","preventionTips":["Keep the bot's web session/access token fresh.","Confirm target inventories are public or owned.","Rate-limit your own requests to avoid 429."],"tags":["steam","inventory","http","client-error","status-code"],"backgroundTag":null,"analyzedSha":"fe57c4129f4ce02d452318cabc525eb49a087255","analyzedAt":"2026-08-13T17:26:20.146Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}