TW2 bot keeps erroring out

Been running this bot for a few weeks now with the same coding with no problem, but i’ve errored out multiple times today. I have the summary of the session, but not sure on how to upload it, so i’ve posted the play session report below. I did remove the coordinates to my villas to help with privacy.

{
“botlabClientVersion”: “2023-05-29”,
“botId”: “e521f262ed8e5cf1672167995c2828710b20f25d92c0a653289b53769ea0dbde”,
“initialBotSettingsHash”: “8eb887”,
“sessionCustomName”: “2023-12-16T23-55-25”,
“onlineSessionId”: “f7093db1062a30084a40”,
“lastBotStep”: {
“sessionAgeMilliseconds”: 2187418,
“statusTextFromBot”: “Session performance: attacks sent: 117, coordinates read: 10824, completed farm cycles: 1\nCompleted first farm cycle 29 minutes ago with 4 villages (Attack limit: 1, Out of units: 3). Sent 89 attacks in 7 minutes.\n—\nSent 28 attacks in the current cycle.\nChecked 1500 unique coordinates and found 456 villages, 168 of which are barbarian villages.\nFound 5 own villages.\nDid not yet read battle reports.\n\n\nCurrent activity:\n\u002B. Last update 8 s ago. 3649 available units. 27 outgoing commands.)\n\u002B\u002B Best matching army preset for this village is \u0027farm \u0027.\n\u002B\u002B\u002B Search for village at —|—.\n—\nSettings: cycles: 45, breaks: 20 - 30, max dist: 75\n--------\nWeb browser status:\nRunning 2 since 170 seconds (started 2 times)”
},
“finishReason”: {
“RuntimeExceptionFinishReason”: [
“System.Exception: Bot task \u0027run-js-517\u0027 has failed with exception\r\n —\u003E System.AggregateException: One or more errors occurred. (One or more errors occurred. (One or more errors occurred. (Value does not fall within the expected range.)))\r\n —\u003E System.AggregateException: One or more errors occurred. (One or more errors occurred. (Value does not fall within the expected range.))\r\n —\u003E System.AggregateException: One or more errors occurred. (Value does not fall within the expected range.)\r\n —\u003E System.ArgumentException: Value does not fall within the expected range.\r\n at Microsoft.Web.WebView2.Core.CoreWebView2.CallDevToolsProtocolMethodAsync(String methodName, String parametersAsJson)\r\n at Microsoft.Web.WebView2.Core.DevToolsProtocolExtension.Runtime.EvaluateAsync(String expression, String objectGroup, Nullable\u00601 includeCommandLineAPI, Nullable\u00601 silent, Nullable\u00601 contextId, Nullable\u00601 returnByValue, Nullable\u00601 generatePreview, Nullable\u00601 userGesture, Nullable\u00601 awaitPromise, Nullable\u00601 throwOnSideEffect, Nullable\u00601 timeout, Nullable\u00601 disableBreaks, Nullable\u00601 replMode, Nullable\u00601 allowUnsafeEvalBlockedByCSP, String uniqueContextId)\r\n at BotLab.Client.GUI.BotWebBrowser.\u003C\u003Ec__DisplayClass9_0.\u003C\u003CChromeDevToolsProtocolRuntimeEvaluateAsync\u003Eb__0\u003Ed.MoveNext()\r\n— End of stack trace from previous location —\r\n at BotLab.Client.GUI.BotWebBrowser.ChromeDevToolsProtocolRuntimeEvaluateAsync(ChromeDevToolsProtocolRuntimeEvaluateParams evaluate)\r\n — End of inner exception stack trace —\r\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n at System.Threading.Tasks.Task\u00601.GetResultCore(Boolean waitCompletionNotification)\r\n at BotLab.Client.GUI.WindowsForPlayerControl.\u003C\u003Ec.\u003CBotLab.Client.IWindowsForPlayer.InvokeMethodOnWindow\u003Eb__10_11(Task\u00601 task)\r\n at System.Threading.Tasks.ContinuationResultTaskFromResultTask\u00602.InnerInvoke()\r\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)\r\n— End of stack trace from previous location —\r\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task\u0026 currentTaskSlot, Thread threadPoolThread)\r\n— End of stack trace from previous location —\r\n at BotLab.Client.DotNetPlatform.Extension.AndThenAsync[ErrT,OkT,MappedOkT](Result\u00602 result, Func\u00602 okMap)\r\n at BotLab.Client.GUI.WindowsForPlayerControl.\u003C\u003Ec__DisplayClass10_0.\u003C\u003CBotLab-Client-IWindowsForPlayer-InvokeMethodOnWindow\u003Eg__continueForWebBrowserWindow|2\u003Ed.MoveNext()\r\n— End of stack trace from previous location —\r\n at BotLab.Client.GUI.WindowsForPlayerControl.\u003C\u003Ec__DisplayClass10_0.\u003C\u003CBotLab-Client-IWindowsForPlayer-InvokeMethodOnWindow\u003Eg__continueWithDevToolsProtocolEvaluate|4\u003Ed.MoveNext()\r\n— End of stack trace from previous location —\r\n at BotLab.Client.GUI.WindowsForPlayerControl.BotLab.Client.IWindowsForPlayer.InvokeMethodOnWindow(String windowId, MethodOnWindow methodOnWindow, CancellationToken cancellationToken)\r\n — End of inner exception stack trace —\r\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n at System.Threading.Tasks.Task\u00601.GetResultCore(Boolean waitCompletionNotification)\r\n at BotLab.Client.PlaySession.PlaySessionWithBot.\u003C\u003Ec__DisplayClass103_0.\u003CStartAgentTask\u003Eb__4(Task\u00601 result)\r\n at System.Threading.Tasks.ContinuationResultTaskFromResultTask\u00602.InnerInvoke()\r\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)\r\n— End of stack trace from previous location —\r\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task\u0026 currentTaskSlot, Thread threadPoolThread)\r\n— End of stack trace from previous location —\r\n at BotLab.Client.PlaySession.PlaySessionWithBot.PerformAgentTaskAndEnqueueEvent(StartTask startTask, CancellationToken cancellationToken)\r\n — End of inner exception stack trace —\r\n — End of inner exception stack trace —\r\n at BotLab.Client.PlaySession.PlaySessionWithBot.CleanUpBotTasksAndPropagateExceptions()\r\n at BotLab.Client.PlaySession.PlaySessionWithBot.ContinueSession(Boolean pauseBot, Func\u00602 overrideUserConfirmedNotFinished)”
]
}
}

1 Like

Hey Trevor,

sorry to hear about these interruptions.
I see you are using an older version of the BotLab client. I recommend you first switch to the new version because we implemented some improvements this year.
In case the error still happens with the new version, the new functionality will help us understand the root cause.
You can download the new version from https://botlabs.blob.core.windows.net/blob-library/by-name/2023-11-21-botlab-client.zip

Thanks for the early morning reply. I’ll give the updated client a try. Thanks for the info.

1 Like

got more errors. Not sure how this updated version was any different than the last, but here’s the info dump.

{
“botlabClientVersion”: “2023-11-21”,
“botId”: “e521f262ed8e5cf1672167995c2828710b20f25d92c0a653289b53769ea0dbde”,
“initialBotSettingsHash”: “8eb887”,
“sessionCustomName”: “2023-12-17T09-21-27”,
“onlineSessionId”: “6670b5729501a3297a2a”,
“lastBotStep”: {
“sessionAgeMilliseconds”: 26104133,
“statusTextFromBot”: “Session performance: attacks sent: 1177, coordinates read: 90832, completed farm cycles: 14\nCompleted 14th farm cycle 32 minutes ago with 6 villages (Attack limit: 2, Out of units: 4). Sent 126 attacks in 9 minutes.\n—\nSent 59 attacks in the current cycle.\nChecked 1900 unique coordinates and found 577 villages, 220 of which are barbarian villages.\nFound 6 own villages.\nDid not yet read battle reports.\n\n\nCurrent activity:\n\u002B Currently selected village is 243 (—|— \u0027village name\u0027. Last update 19 s ago. 734 available units. 7 outgoing commands.)\n\u002B\u002B Best matching army preset for this village is \u0027farm AXE\u0027.\n\u002B\u002B\u002B Search for village at —|—.\n—\nSettings: cycles: 45, breaks: 20 - 30, max dist: 75\n--------\nWeb browser status:\nRunning 17 since 279 seconds (started 17 times)”
},
“finishReason”: {
“RuntimeExceptionFinishReason”: [
“System.Exception: Bot task \u0027run-js-4966\u0027 has failed with exception\r\n —\u003E System.AggregateException: One or more errors occurred. (One or more errors occurred. (One or more errors occurred. (Value does not fall within the expected range.)))\r\n —\u003E System.AggregateException: One or more errors occurred. (One or more errors occurred. (Value does not fall within the expected range.))\r\n —\u003E System.AggregateException: One or more errors occurred. (Value does not fall within the expected range.)\r\n —\u003E System.ArgumentException: Value does not fall within the expected range.\r\n at Microsoft.Web.WebView2.Core.CoreWebView2.CallDevToolsProtocolMethodAsync(String methodName, String parametersAsJson)\r\n at Microsoft.Web.WebView2.Core.DevToolsProtocolExtension.Runtime.EvaluateAsync(String expression, String objectGroup, Nullable\u00601 includeCommandLineAPI, Nullable\u00601 silent, Nullable\u00601 contextId, Nullable\u00601 returnByValue, Nullable\u00601 generatePreview, Nullable\u00601 userGesture, Nullable\u00601 awaitPromise, Nullable\u00601 throwOnSideEffect, Nullable\u00601 timeout, Nullable\u00601 disableBreaks, Nullable\u00601 replMode, Nullable\u00601 allowUnsafeEvalBlockedByCSP, String uniqueContextId)\r\n at BotLab.Client.GUI.BotWebBrowser.\u003C\u003Ec__DisplayClass9_0.\u003C\u003CChromeDevToolsProtocolRuntimeEvaluateAsync\u003Eb__0\u003Ed.MoveNext()\r\n— End of stack trace from previous location —\r\n at BotLab.Client.GUI.BotWebBrowser.ChromeDevToolsProtocolRuntimeEvaluateAsync(ChromeDevToolsProtocolRuntimeEvaluateParams evaluate)\r\n — End of inner exception stack trace —\r\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n at System.Threading.Tasks.Task\u00601.get_Result()\r\n at BotLab.Client.GUI.WindowsForPlayerControl.\u003C\u003Ec.\u003CBotLab.Client.IWindowsForPlayer.InvokeMethodOnWindow\u003Eb__10_11(Task\u00601 task)\r\n at System.Threading.Tasks.ContinuationResultTaskFromResultTask\u00602.InnerInvoke()\r\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)\r\n— End of stack trace from previous location —\r\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task\u0026 currentTaskSlot, Thread threadPoolThread)\r\n— End of stack trace from previous location —\r\n at BotLab.Client.DotNetPlatform.Extension.AndThenAsync[ErrT,OkT,MappedOkT](Result\u00602 result, Func\u00602 okMap)\r\n at BotLab.Client.GUI.WindowsForPlayerControl.\u003C\u003Ec__DisplayClass10_0.\u003C\u003CBotLab-Client-IWindowsForPlayer-InvokeMethodOnWindow\u003Eg__continueForWebBrowserWindow|2\u003Ed.MoveNext()\r\n— End of stack trace from previous location —\r\n at BotLab.Client.GUI.WindowsForPlayerControl.\u003C\u003Ec__DisplayClass10_0.\u003C\u003CBotLab-Client-IWindowsForPlayer-InvokeMethodOnWindow\u003Eg__continueWithDevToolsProtocolEvaluate|4\u003Ed.MoveNext()\r\n— End of stack trace from previous location —\r\n at BotLab.Client.GUI.WindowsForPlayerControl.BotLab.Client.IWindowsForPlayer.InvokeMethodOnWindow(String windowId, MethodOnWindow methodOnWindow, CancellationToken cancellationToken)\r\n — End of inner exception stack trace —\r\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n at System.Threading.Tasks.Task\u00601.get_Result()\r\n at BotLab.Client.PlaySession.PlaySessionWithBot.\u003C\u003Ec__DisplayClass114_0.\u003CStartAgentTask\u003Eb__4(Task\u00601 result)\r\n at System.Threading.Tasks.ContinuationResultTaskFromResultTask\u00602.InnerInvoke()\r\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)\r\n— End of stack trace from previous location —\r\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task\u0026 currentTaskSlot, Thread threadPoolThread)\r\n— End of stack trace from previous location —\r\n at BotLab.Client.PlaySession.PlaySessionWithBot.PerformAgentTaskAndEnqueueEvent(StartTask startTask, CancellationToken cancellationToken)\r\n — End of inner exception stack trace —\r\n — End of inner exception stack trace —\r\n at BotLab.Client.PlaySession.PlaySessionWithBot.CleanUpBotTasksAndPropagateExceptions()\r\n at BotLab.Client.PlaySession.PlaySessionWithBot.ContinueSession(Boolean pauseBot, Func\u00602 overrideUserConfirmedNotFinished)”
]
}
}

1 Like

Here is a gyazo image of the error that pops up.

1 Like

Thank you for the update!
Those logs helped me find a solution, and I implemented a fix in the BotLab client.
You can download the new client from https://botlabs.blob.core.windows.net/blob-library/by-name/2023-12-18-botlab-client.zip

That should restore normal operation for you.

1 Like