System error thrown: Throw - Orchestrator


An error is being thrown in a process built that:

1st. reads a really huge Excel file and saves it into a datatable
2nd. for each row, it loads it into a queue in Orchestrator

The 1st step is done correctly, but while uploading the items into the queue in Orchestrator, it throws this error after a while, after having loaded several items it stops:


Source: Throw - Orchestrator

Message: An error has occurred. Error code: 0

Exception Type: System.Exception

RemoteException wrapping System.Exception: An error has occurred. Error code: 0
at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Please can someone help with this?

Thanks in advance for the help!!

@mpayer Did you try loading the whole data table at once using Bulk Add Queue Item Activity

1 Like

I’ve seen this a lot when trying to add a lot of items to a queue rapidly.

You should use Bulk Add Queue Items instead of looping through a datatable and using Add Queue Item.

Hi @mpayer,

It depends where your Orchestrator instance is. Is it on-premises or cloud? As you suggest your datatable being sent contains large number of rows. By large I mean relatively large for Bulk Add Queue Item.

I have not come across the exact error message, but I am suspecting this is more to do with the network connection than either of the add item activities ( Add Queue Item, Bulk Add Queue Item)

@mpayer @ushu and @postwick
Before you use Bulk Add Queue Item
There are some important aspects to consider before using Bulk Add Queue Item.

  1. In my testing, a datatable over 4000-5000 rows should not be sent to the orchestrator using Bulk Add Queue Item. This is because, both with all or nothing and process independently, this activity returns a json string as output (Result). If the post data is huge, you will get a large json string back and UiPath Studio / Robot cannot handle this large incoming data into memory.
  2. The only optimal way to check (post-condition) if this activity worked as intended is check if the Result json string was obtained and contained similar count of field values as the datatable rows count. Dont try to get queue items again to check if the queue has items as get queue item will only fetch you 100 items per iteration, this means you have to make another loop to get all items posted to queue and count them. That’s why just checking the json string is a optimal approach.
  3. Process All Independently may also work in this case as it is essentially a inbuild for loop in combination with Add Queue Item.
  4. @AndersJensen, I personally avoid Process All Independently, because some days when the dispatcher fails you do not want to clean the queue before running the dispatcher again for the process. If the dispatcher fails with All or Nothing, you are sure that the dispatcher did not work at all and this reduces need of handling already sent items and items still to be sent.

Our dispatcher template solution
The way we solved it was a simple check on the datatable rows. If the row count is large, we use Add Queue Item (one by one in a for each datatable loop) and if the row count is smaller than 4500, then we use the Bulk Add Queue Item activity as the returning json string can be handled by Studio / robot.