Fix Salesforce Junction IDs Limit Exceeded Error

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

What Does This Error 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

  • Event (most common case)
  • Task
  • Campaign
  • Opportunity
  • Case
  • 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, or object-specific fields. 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.

Useful Links

    • Related Articles

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

      Overview The TotalRequests Limit Exceeded and ApiBatchItems Limit Exceeded errors are Salesforce-side governor limits. They are not related to Skyvia's own limits. When these limits are reached, Salesforce rejects all further API calls until the ...
    • Salesforce: Inactive User Error

      Overview 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 ...
    • Skyvia Backup Errors Caused by Salesforce API Requirements

      Overview Skyvia interacts with Salesforce via its API. During a backup or replication operation, you may encounter errors caused by certain limitations or behaviors specific to the Salesforce API. Why This Happens When Skyvia performs a backup or ...
    • Salesforce Report exports only 2000 records

      Overview When using Salesforce Reports as a data source in Skyvia, the export is limited to the first 2,000 rows. This is not a Skyvia limitation — it is a hard restriction imposed by the Salesforce Run Report API, which Skyvia uses to retrieve ...
    • UPDATED: Salesforce: Expired access/refresh token

      Overview If you see an "expired access/refresh token" error, your Salesforce OAuth connection is invalid. This happens when the token has expired, been revoked, or invalidated by a Salesforce security policy change. Possible Causes The OAuth token ...