JustArchiNET/ArchiSteamFarm · error · TimeoutException
Failed due to error: Client.IsConnected
Error message
Failed due to error: Client.IsConnected
What it means
Thrown at the start of ArchiHandler.GetMyInventoryAsync (the SteamKit2/GameCoordinator protocol path for fetching the bot's OWN inventory). It asserts the SteamKit2 Client is connected and that Client.SteamID is set before issuing a CEcon inventory request; otherwise it raises a TimeoutException. This is a preflight guard, not a response-handling error.
Source
Thrown at ArchiSteamFarm/Steam/Integration/ArchiHandler.cs:192
try {
response = await UnifiedCredentialsService.GetCredentialChangeTimeDetails(request).ToLongRunningTask().ConfigureAwait(false);
} catch (Exception e) {
ArchiLogger.LogGenericWarningException(e);
return null;
}
return response.Result == EResult.OK ? response.Body : null;
}
[PublicAPI]
public async IAsyncEnumerable<Asset> GetMyInventoryAsync(uint appID = Asset.SteamAppID, ulong contextID = Asset.SteamCommunityContextID, bool tradableOnly = false, bool marketableOnly = false, ushort itemsCountPerRequest = ArchiWebHandler.MaxItemsInSingleInventoryRequest, string? language = null) {
ArgumentOutOfRangeException.ThrowIfZero(appID);
ArgumentOutOfRangeException.ThrowIfZero(contextID);
ArgumentOutOfRangeException.ThrowIfZero(itemsCountPerRequest);
if (!Client.IsConnected || (Client.SteamID == null)) {
throw new TimeoutException(Strings.FormatWarningFailedWithError(nameof(Client.IsConnected)));
}
ulong steamID = Client.SteamID;
if (steamID == 0) {
throw new InvalidOperationException(nameof(Client.SteamID));
}
CEcon_GetInventoryItemsWithDescriptions_Request request = new() {
appid = appID,
contextid = contextID,
filters = new CEcon_GetInventoryItemsWithDescriptions_Request.FilterOptions {
tradable_only = tradableOnly,
marketable_only = marketableOnly
},
get_descriptions = true,View on GitHub (pinned to fe57c4129f)
Solutions
- Ensure Bot.IsConnectedAndLoggedOn is true before requesting the inventory.
- Retry the call after the bot re-establishes its session.
- Check ASF logs for the underlying disconnect reason and resolve it first.
- Avoid calling inventory methods during startup/shutdown windows.
Example fix
// before
var inv = bot.ArchiHandler.GetMyInventoryAsync();
// after
if (!bot.IsConnectedAndLoggedOn) { /* wait or skip */ return; }
var inv = bot.ArchiHandler.GetMyInventoryAsync(); Defensive patterns
Strategy: validation
Validate before calling
if (!bot.IsConnectedAndLoggedOn || bot.ArchiHandler.Client?.IsConnected != true)
throw new InvalidOperationException("Steam client not ready for inventory"); Type guard
static bool CanFetchOwnInventory(Bot bot) =>
bot.IsConnectedAndLoggedOn && bot.ArchiHandler.Client.IsConnected
&& bot.ArchiHandler.Client.SteamID != null; Try / catch
try { await foreach (var a in handler.GetMyInventoryAsync()) { /* ... */ } }
catch (TimeoutException ex) when (ex.Message.Contains("Client.IsConnected")) {
// session dropped; wait for reconnect before retrying
} Prevention
- Gate inventory calls behind IsConnectedAndLoggedOn.
- Do not call inventory methods during startup or shutdown.
- Reconnect the bot before retrying after a disconnect.
When it happens
Trigger: Calling GetMyInventoryAsync while the SteamClient is disconnected, during reconnect, before logon completes, or right after a dropped connection where SteamID is no longer populated.
Common situations: Code path invoked before OnLoggedOn; calling inventory fetch immediately after Start() without awaiting connection; network blip or Steam restart caused an unexpected disconnect; rate-limit/ban severed the session mid-operation.
Related errors
AI-assisted analysis of JustArchiNET/ArchiSteamFarm@fe57c4129f (2026-08-13).
Data as JSON: /api/errors/5d93f25e1f9cbdf5.
Report an issue: GitHub.