Salesforce Error: “Query is requesting too many junction IDs; limit is 500”

Salesforce Error: “Query is requesting too many junction IDs; limit is 500”

What does it mean 

This Salesforce error occurs when a SOQL query attempts to retrieve more than 500 junction IDs in a single request. Salesforce enforces a hard API limit of 500 junction IDs per query, and once this limit is exceeded, the query fails.

This limitation applies to any Salesforce object that has many related records via junction (many-to-many) relationships. It is a Salesforce API restriction, not a Skyvia issue.

Objects commonly affected

  1. Event (most common case)
  2. Task
  3. Campaign
  4. Opportunity
  5. Case
  6. Custom objects with junction relationships
Objects with a large number of related records (Contacts, Leads, Accounts, etc.) are especially prone to this error during full or large-scale replications.

How to avoid the error

1. Narrow the query using Filter Settings. Limit the data volume per run by using filters such as: CreatedDate, LastModifiedDate, OwnerId, object-specific fields etc. Smaller data slices result in fewer junction IDs expanded per query.
2. Split the replication into smaller batches. Replicating in date ranges is the most effective way to stay under the 500-Id limit.
3. Temporarily exclude non-essential related (junction) objects - If certain related objects are not required, temporarily exclude them from replication to reduce junction ID expansion.
4. Query only necessary fields - avoid selecting all fields or unnecessary lookup/relationship columns, as they can trigger additional junction ID expansion.

Please check these links to know more: 


    • Related Articles

    • Salesforce API errors: TotalRequests Limit Exceeded/ApiBatchItems Limit Exceeded

      The TotalRequests Limit Exceeded and ApiBatchItems Limit Exceeded errors are Salesforce-specific errors indicating that you have reached specific API limits on the Salesforce platform. Please find explanations of each error and relevant documentation ...
    • Skyvia Backup Errors Caused by Salesforce API Requirements

      Skyvia interacts with Salesforce via its API. During a backup operation, you may encounter errors due to certain limitations or behaviors specific to the Salesforce API. For example, when Skyvia performs a backup or replication, it queries all the ...
    • Resolving the "Inactive User" Error in Skyvia Salesforce Connections

      The "inactive user" error occurs at the Salesforce connection level in Skyvia. It means that the Salesforce user account used for the connection is inactive or no longer valid, so Salesforce blocks API authentication. As a result, Skyvia cannot run ...
    • Salesforce: Expired access/refresh token

      If you see an "expired access/refresh token" error, your Salesforce OAuth connection is invalid due to token expiration or revocation. Please open your Salesforce connection, sign in again to get a new token, and save it. Click the Test Connection ...
    • Query execution timeout exceeded error

      This error occurs when a query takes too long to execute, typically because it processes a large dataset or uses inefficient filters. To resolve the issue: Apply WHERE filters to reduce the amount of data being queried. Review and optimize JOINs and ...