How to troubleshoot the "Error while copying content to a stream" message for the Verify Expression with Operator activity in the UiPath.Testing.Activities package?
Error sporadically shown in Studio for the Verify Expression with Operator activity.
9:32:01.1903 => [ERROR] [UiPath.Studio.App.Logging.OutputLogger] [26] Verify the image: Error while copying content to a stream. 09:32:01.2546 => [ERROR] [UiPath.Studio.App.Logging.OutputLogger] [26] System.Net.Http.HttpRequestException: Error while copying content to a stream. ---> System.IO.IOException: Received an unexpected EOF or 0 bytes from the transport stream. at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](CancellationToken cancellationToken, Int32 estimatedSize) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](Memory`1 buffer, CancellationToken cancellationToken) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Net.Http.HttpConnection.FillAsync(Boolean async) at System.Net.Http.HttpConnection.CopyToContentLengthAsync(Stream destination, Boolean async, UInt64 length, Int32 bufferSize, CancellationToken cancellationToken) at System.Net.Http.HttpConnection.ContentLengthReadStream.CompleteCopyToAsync(Task copyTask, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionResponseContent.g__Impl|6_0(Stream stream, CancellationToken cancellationToken) at System.Net.Http.HttpContent.LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStream tempBuffer) --- End of inner exception stack trace --- at System.Net.Http.HttpContent.LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStream tempBuffer) at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at UiPath.Testing.Activities.Api.Rest.HttpClientRestApi.MakeRequestAsync(String resource, HttpMethod method, Func`2 onError, HttpContent data, CancellationToken cancellationToken) at UiPath.Testing.Activities.Api.Rest.HttpClientRestApi.GetRequestAsync(String resource, Func`2 onError, CancellationToken cancellationToken) at UiPath.Testing.Activities.OrchestratorService.InitializeAsync(Boolean shouldExitIfNotConnected) at UiPath.Testing.Activities.OrchestratorService.PostAssertionToOrchestrator(Assertion assertion, String screenshotFile) at UiPath.Testing.Activities.AssertionActivity.ExecuteAsync(NativeActivityContext context, CancellationToken cancellationToken) at UiPath.Shared.Activities.AsyncTaskNativeImplementation.BookmarkResumptionCallback(NativeActivityContext context, Object value) at UiPath.Shared.Activities.AsyncTaskNativeActivity.BookmarkResumptionCallback(NativeActivityContext context, Bookmark bookmark, Object value) at System.Activities.Runtime.BookmarkWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
Note: This screenshot is provided for reference only; the object being verified, in this case, "Facebook Link," may change depending on your process.
Example of error displayed before executing the Verify Expression with Operator in the yyyy-mm-dd_UiPath.Studio.log logs:
07:42:17.6845 => [ERROR] [UiPath.Studio.App.Logging.OutputLogger] [34] UiPath.CoreIpc.RemoteException: A local license is required. at UiPath.Service.AttendedService.<>c__DisplayClass19_0.<g__CheckOfflineLicense|0>d.MoveNext() --- End of stack trace from previous location --- at UiPath.Service.AttendedService.StartJob(JobModel jobModel, Guid sessionJobId, Message message) at UiPath.CoreIpc.Server.<>c__DisplayClass7_3.<g__InvokeMethod|6>d.MoveNext() --- End of stack trace from previous location --- at UiPath.CoreIpc.Server.<>c__DisplayClass7_1.<g__HandleRequest|3>d.MoveNext() --- End of stack trace from previous location --- at UiPath.CoreIpc.Server.<>c__DisplayClass7_2.<b__5>d.MoveNext() --- End of stack trace from previous location --- at UiPath.CoreIpc.Helpers.Timeout[TResult](TimeSpan timeout, List`1 cancellationTokens, Func`2 func, String message, Func`2 exceptionHandler)
Cause:
An error occurred stating 'A local license is required' before executing the Verify Expression with Operator activity. Since a Studio license is required for running and debugging a project, if the user is not using a standalone license, a stable connection to Orchestrator is necessary to maintain the license for continued usage. It's likely that there was a disruption in your internal network, causing a loss of communication between Orchestrator and Studio. For any further Studio operations that involve execution, a Studio license is necessary to run the automation.
Solution:
For this type of scenario, when the issue occurs sporadically, adding the activity within a Retry Scope and attempting it a few times within a 30-second to 1-minute interval can help address the internal network issue.