{"record":{"id":"0038f3679eae3e7e","repo":"JustArchiNET/ArchiSteamFarm","slug":"failed","errorCode":null,"errorMessage":"Failed!","messagePattern":"Failed!","errorType":"exception","errorClass":"HttpRequestException","httpStatus":null,"severity":"error","filePath":"ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs","lineNumber":300,"sourceCode":"\t///     If targetting inventory of this <see cref=\"Bot\" /> instance, consider using much more efficient <see cref=\"ArchiHandler.GetMyInventoryAsync\" /> instead.\n\t///     This method should be used exclusively for foreign inventories (other users), but in special circumstances it can be used for fetching bot's own inventory as well.\n\t/// </remarks>\n\t[PublicAPI]\n\tpublic async IAsyncEnumerable<Asset> GetInventoryAsync(ulong steamID = 0, uint appID = Asset.SteamAppID, ulong contextID = Asset.SteamCommunityContextID, ushort itemsCountPerRequest = MaxItemsInSingleInventoryRequest, string? language = null) {\n\t\tArgumentOutOfRangeException.ThrowIfZero(appID);\n\t\tArgumentOutOfRangeException.ThrowIfZero(contextID);\n\t\tArgumentOutOfRangeException.ThrowIfZero(itemsCountPerRequest);\n\n\t\tif (steamID == 0) {\n\t\t\tif (!Initialized) {\n\t\t\t\tbyte connectionTimeout = ASF.GlobalConfig?.ConnectionTimeout ?? GlobalConfig.DefaultConnectionTimeout;\n\n\t\t\t\tfor (byte i = 0; (i < connectionTimeout) && !Initialized && Bot.IsConnectedAndLoggedOn; i++) {\n\t\t\t\t\tawait Task.Delay(1000).ConfigureAwait(false);\n\t\t\t\t}\n\n\t\t\t\tif (!Initialized) {\n\t\t\t\t\tthrow new HttpRequestException(Strings.WarningFailed);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsteamID = Bot.SteamID;\n\t\t} else if (!new SteamID(steamID).IsIndividualAccount) {\n\t\t\tthrow new NotSupportedException(Strings.FormatErrorObjectIsNull(nameof(steamID)));\n\t\t}\n\n\t\tif (ASF.InventorySemaphore == null) {\n\t\t\tthrow new InvalidOperationException(nameof(ASF.InventorySemaphore));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(language)) {\n\t\t\tlanguage = \"english\";\n\t\t}\n\n\t\tulong startAssetID = 0;\n","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/JustArchiNET/ArchiSteamFarm/blob/fe57c4129f4ce02d452318cabc525eb49a087255/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs#L282-L318","documentation":"In ArchiWebHandler.GetInventoryAsync (the HTTP inventory path, used for foreign inventories or as a fallback), when the requested steamID is 0 (meaning 'use the bot's own ID'), ASF waits up to ConnectionTimeout seconds for the web session to Initialize. If it never initializes, an HttpRequestException(Strings.WarningFailed) ('Failed!') is thrown. This is a session-readiness timeout, not an HTTP call failure.","triggerScenarios":"Calling GetInventoryAsync(steamID: 0) while the bot's web access token/session is not yet initialized, and it fails to initialize within ConnectionTimeout seconds, or the bot is no longer connected/logged on during the wait (the loop also stops if Bot.IsConnectedAndLoggedOn becomes false).","commonSituations":"Calling inventory fetch during startup before web session refresh completes; access token expired and refresh keeps failing; login disconnected mid-wait; ConnectionTimeout too short under slow networks.","solutions":["Wait until Bot's web session is initialized before requesting inventory.","Increase ASF's ConnectionTimeout.","Ensure the bot is logged on (check IsConnectedAndLoggedOn) before the call.","Retry after the session refreshes; resolve any underlying login/access-token errors first."],"exampleFix":"// before\nvar inv = bot.ArchiWebHandler.GetInventoryAsync();\n// after\nif (!bot.ArchiWebHandler.Initialized) { /* wait for session init */ return; }\nvar inv = bot.ArchiWebHandler.GetInventoryAsync();","handlingStrategy":"validation","validationCode":"if (steamID == 0 && !bot.ArchiWebHandler.Initialized)\n    throw new InvalidOperationException(\"Web session not initialized; cannot fetch inventory\");","typeGuard":"static bool CanFetchWebInventory(Bot bot, ulong steamID) =>\n    steamID != 0 || bot.ArchiWebHandler.Initialized;","tryCatchPattern":"try { await foreach (var a in webHandler.GetInventoryAsync()) { /* ... */ } }\ncatch (HttpRequestException ex) when (ex.Message == Strings.WarningFailed) {\n    // session init timeout; wait and retry\n}","preventionTips":["Ensure the bot is logged on and web session is initialized before fetching.","Raise ConnectionTimeout for slow networks.","Resolve persistent session-refresh failures before retrying."],"tags":["steam","inventory","web-session","timeout","http"],"backgroundTag":null,"analyzedSha":"fe57c4129f4ce02d452318cabc525eb49a087255","analyzedAt":"2026-08-13T17:26:20.146Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}