{"record":{"id":"5d93f25e1f9cbdf5","repo":"JustArchiNET/ArchiSteamFarm","slug":"failed-due-to-error-client-isconnected","errorCode":null,"errorMessage":"Failed due to error: Client.IsConnected","messagePattern":"Failed due to error: Client\\.IsConnected","errorType":"exception","errorClass":"TimeoutException","httpStatus":null,"severity":"error","filePath":"ArchiSteamFarm/Steam/Integration/ArchiHandler.cs","lineNumber":192,"sourceCode":"\t\ttry {\n\t\t\tresponse = await UnifiedCredentialsService.GetCredentialChangeTimeDetails(request).ToLongRunningTask().ConfigureAwait(false);\n\t\t} catch (Exception e) {\n\t\t\tArchiLogger.LogGenericWarningException(e);\n\n\t\t\treturn null;\n\t\t}\n\n\t\treturn response.Result == EResult.OK ? response.Body : null;\n\t}\n\n\t[PublicAPI]\n\tpublic 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) {\n\t\tArgumentOutOfRangeException.ThrowIfZero(appID);\n\t\tArgumentOutOfRangeException.ThrowIfZero(contextID);\n\t\tArgumentOutOfRangeException.ThrowIfZero(itemsCountPerRequest);\n\n\t\tif (!Client.IsConnected || (Client.SteamID == null)) {\n\t\t\tthrow new TimeoutException(Strings.FormatWarningFailedWithError(nameof(Client.IsConnected)));\n\t\t}\n\n\t\tulong steamID = Client.SteamID;\n\n\t\tif (steamID == 0) {\n\t\t\tthrow new InvalidOperationException(nameof(Client.SteamID));\n\t\t}\n\n\t\tCEcon_GetInventoryItemsWithDescriptions_Request request = new() {\n\t\t\tappid = appID,\n\t\t\tcontextid = contextID,\n\n\t\t\tfilters = new CEcon_GetInventoryItemsWithDescriptions_Request.FilterOptions {\n\t\t\t\ttradable_only = tradableOnly,\n\t\t\t\tmarketable_only = marketableOnly\n\t\t\t},\n\n\t\t\tget_descriptions = true,","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/JustArchiNET/ArchiSteamFarm/blob/fe57c4129f4ce02d452318cabc525eb49a087255/ArchiSteamFarm/Steam/Integration/ArchiHandler.cs#L174-L210","documentation":"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.","triggerScenarios":"Calling GetMyInventoryAsync while the SteamClient is disconnected, during reconnect, before logon completes, or right after a dropped connection where SteamID is no longer populated.","commonSituations":"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.","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."],"exampleFix":"// before\nvar inv = bot.ArchiHandler.GetMyInventoryAsync();\n// after\nif (!bot.IsConnectedAndLoggedOn) { /* wait or skip */ return; }\nvar inv = bot.ArchiHandler.GetMyInventoryAsync();","handlingStrategy":"validation","validationCode":"if (!bot.IsConnectedAndLoggedOn || bot.ArchiHandler.Client?.IsConnected != true)\n    throw new InvalidOperationException(\"Steam client not ready for inventory\");","typeGuard":"static bool CanFetchOwnInventory(Bot bot) =>\n    bot.IsConnectedAndLoggedOn && bot.ArchiHandler.Client.IsConnected\n    && bot.ArchiHandler.Client.SteamID != null;","tryCatchPattern":"try { await foreach (var a in handler.GetMyInventoryAsync()) { /* ... */ } }\ncatch (TimeoutException ex) when (ex.Message.Contains(\"Client.IsConnected\")) {\n    // session dropped; wait for reconnect before retrying\n}","preventionTips":["Gate inventory calls behind IsConnectedAndLoggedOn.","Do not call inventory methods during startup or shutdown.","Reconnect the bot before retrying after a disconnect."],"tags":["steam","inventory","network","steamkit2","connection"],"backgroundTag":null,"analyzedSha":"fe57c4129f4ce02d452318cabc525eb49a087255","analyzedAt":"2026-08-13T17:26:20.146Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}