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.
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.
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.
Process All Independently may also work in this case as it is essentially a inbuild for loop in combination with Add Queue Item.
@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.