The query fetches the orders between two dates, with their associated agreements, sales, line items. If i drop the sales connection from the query - no errors.
Update: it looks like if i remove the sales from the query, the bulk operation completes successfully. Can somebody from the shopify devs take a look at what is failing and how to mitigate the problem?