JustArchiNET/ArchiSteamFarm · error · HttpRequestException
Failed!
Error message
Failed!
What it means
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.
Source
Thrown at ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs:300
/// If targetting inventory of this <see cref="Bot" /> instance, consider using much more efficient <see cref="ArchiHandler.GetMyInventoryAsync" /> instead.
/// 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.
/// </remarks>
[PublicAPI]
public async IAsyncEnumerable<Asset> GetInventoryAsync(ulong steamID = 0, uint appID = Asset.SteamAppID, ulong contextID = Asset.SteamCommunityContextID, ushort itemsCountPerRequest = MaxItemsInSingleInventoryRequest, string? language = null) {
ArgumentOutOfRangeException.ThrowIfZero(appID);
ArgumentOutOfRangeException.ThrowIfZero(contextID);
ArgumentOutOfRangeException.ThrowIfZero(itemsCountPerRequest);
if (steamID == 0) {
if (!Initialized) {
byte connectionTimeout = ASF.GlobalConfig?.ConnectionTimeout ?? GlobalConfig.DefaultConnectionTimeout;
for (byte i = 0; (i < connectionTimeout) && !Initialized && Bot.IsConnectedAndLoggedOn; i++) {
await Task.Delay(1000).ConfigureAwait(false);
}
if (!Initialized) {
throw new HttpRequestException(Strings.WarningFailed);
}
}
steamID = Bot.SteamID;
} else if (!new SteamID(steamID).IsIndividualAccount) {
throw new NotSupportedException(Strings.FormatErrorObjectIsNull(nameof(steamID)));
}
if (ASF.InventorySemaphore == null) {
throw new InvalidOperationException(nameof(ASF.InventorySemaphore));
}
if (string.IsNullOrEmpty(language)) {
language = "english";
}
ulong startAssetID = 0;
View on GitHub (pinned to fe57c4129f)
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.
Example fix
// before
var inv = bot.ArchiWebHandler.GetInventoryAsync();
// after
if (!bot.ArchiWebHandler.Initialized) { /* wait for session init */ return; }
var inv = bot.ArchiWebHandler.GetInventoryAsync(); Defensive patterns
Strategy: validation
Validate before calling
if (steamID == 0 && !bot.ArchiWebHandler.Initialized)
throw new InvalidOperationException("Web session not initialized; cannot fetch inventory"); Type guard
static bool CanFetchWebInventory(Bot bot, ulong steamID) =>
steamID != 0 || bot.ArchiWebHandler.Initialized; Try / catch
try { await foreach (var a in webHandler.GetInventoryAsync()) { /* ... */ } }
catch (HttpRequestException ex) when (ex.Message == Strings.WarningFailed) {
// session init timeout; wait and retry
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- response is null!
- response is null!
- Failed due to error: {0}
- Failed due to error: Client.IsConnected
- Failed due to error: {0}
AI-assisted analysis of JustArchiNET/ArchiSteamFarm@fe57c4129f (2026-08-13).
Data as JSON: /api/errors/0038f3679eae3e7e.
Report an issue: GitHub.