When making a REST API query call from a Java client I'm getting an INVALID_QUERY_LOCATOR error. I'm familiar with the limitation around 10 query locators in the same time and in my code I'm avoiding running more than 10 queries in parallel. However in some cases I'm still getting this error.

The following steps will reproduce this error consistently:

  1. Run 10 queries that will return partial results in rest API, e.g. "Select Id from Account Limit 2100". Only run the first part so all query locators are now open.
  2. Finish one of the queries by calling its nextRecordsURL until the results is done. This is supposed to release the query locator.
  3. Now run another query same as the above - it is expected to grab that query locator that was just released.
  4. Finish all other queries. You will fail on the first query that was started. The query from before "stole" its query locator and now we get INVALID_QUERY_LOCATOR

I've read the following articles but none of them seem to shed more light on this issue in this specific scenario:

https://help.salesforce.com/apex/HTViewSolution?id=000004410&language=en_US http://knowledgebase.progress.com/articles/Article/6070

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.