Loading

'INVALID_QUERY_LOCATOR ' Salesforce Error

Veröffentlichungsdatum: Apr 24, 2026
Beschreibung

The INVALID_QUERY_LOCATOR error and related extended error codes indicate the query locator included in a call for additional query results is invalid or doesn’t exist. 

Lösung

Overview of Query Locators

When results for a large or complex query cannot be returned in a single response, Salesforce creates one or more server-side cursors. Cursors point to the location of additional query results in the database. These additional results are retrieved using a query locator within another call — such as the queryMore() call in the SOAP API or the nextRecordsUrl field in the REST API.
For example, consider a query where the batch size is set to 2,000 and the organization has more than 2,000 accounts. In this scenario, SELECT id FROM account returns 2,000 records and a query locator, indicating where the additional call can find and retrieve the remaining records.
A query locator is 18 characters long and begins with the prefix 0r8. Each locator and its associated results are available for two days after the initial query executes. Using an invalid or expired query locator in a call throws an INVALID_QUERY_LOCATOR error.

Use Extended Error Codes to Troubleshoot

When you receive the INVALID_QUERY_LOCATOR error, review the extended error code in the response to identify the root cause and apply the appropriate resolution:

  • INVALID_QUERY_LOCATOR_FORMAT — The query locator string is malformed or has been modified. Verify that the locator value has not been altered. Re-execute the original query to obtain a valid locator.
  • LOCATOR_LOCATION_EXCEEDS_SIZE — The position pointed to by the locator exceeds the total result set size. Re-execute the original query to obtain a fresh locator.
  • QUERY_LOCATOR_EXPIRED — The query locator has exceeded its 2-day availability window. Re-execute the original SOQL or SOSL query to obtain a new locator.
  • TEMPORARY_QUERY_MORE_FAILURE — A transient server-side error occurred while processing the queryMore() request. Retry the call. If the issue persists, contact Salesforce Support.
  • UNAUTHORIZED_USER_FOR_CURSOR — The user making the queryMore() call is different from the user who executed the original query. Ensure the same user session is used for both the initial query and all subsequent queryMore() calls.

For full details on extended error codes, see the ExtendedErrorCode section of the SOAP API Developer Guide.

Nummer des Knowledge-Artikels

000384958

 
Laden
Salesforce Help | Article