Mobile SDK REST API sync fails when offline queue exceeds limit

Our field sales team uses the Salesforce Mobile SDK for iOS, and we’re hitting a critical issue with offline data synchronization. When sales reps work in areas with poor connectivity and accumulate more than 200 pending records in the offline queue, the sync process fails completely when they reconnect.

The error we’re seeing in the mobile logs:


SyncManager Error: Queue overflow
Pending operations: 247
Max queue size: 200
Sync status: FAILED

We’ve configured the Mobile SDK with SmartStore for local persistence and SmartSync for synchronization. The queue limit seems to be a hard constraint, and when it’s exceeded, we lose all pending changes - which is unacceptable for our business. Sales reps are losing hours of work including opportunity updates, contact modifications, and activity logs.

Is there a way to increase the offline queue limit or implement a batch processing strategy that handles large sync volumes? We’re on Winter '25 with Mobile SDK version 11.0. This is causing significant data loss in the field.

Your offline queue overflow issue requires a multi-layered solution addressing Mobile SDK configuration, sync architecture, and error handling. Here’s the comprehensive approach:

1. Mobile SDK Offline Queue Management - Increase and Monitor Limits:

The 200-record default is configurable. In your Mobile SDK initialization code, adjust the SyncManager configuration:

let syncConfig = SyncOptions(
  maxSyncQueueSize: 500,
  syncBatchSize: 50
)
SyncManager.shared.configure(syncConfig)

However, don’t just increase the limit blindly. Monitor queue depth and trigger warnings at 75% capacity so reps can sync proactively.

2. Sync Error Handling - Implement Graceful Degradation:

The critical flaw in your current setup is the all-or-nothing sync failure. Implement error handling that preserves data even when sync fails:

if syncQueue.count > maxSize {
  // Archive overflow to local storage
  archiveOverflowRecords()
  // Continue with priority records
  syncPriorityQueue()
}

Create a secondary persistence layer in SmartStore for overflow records. These can be synced in subsequent attempts rather than being lost.

3. Batch Processing Strategies - Chunked Synchronization:

Replace single large sync operations with batched processing:

Priority-Based Batching:

  • Batch 1: Opportunities and high-value records (sync immediately)
  • Batch 2: Contacts and accounts (sync within 5 minutes)
  • Batch 3: Activities and notes (sync when bandwidth allows)

Implementation approach:

func processSyncQueue() {
  let batches = queue.chunked(into: 50)
  for batch in batches {
    syncBatch(batch) { result in
      if case .failure = result {
        retryQueue.append(batch)
      }
    }
  }
}

Additional Critical Fixes:

Conflict Resolution Configuration: Set up explicit conflict handling policies in your SyncManager:

  • For Opportunities: Use MERGE strategy with field-level precedence
  • For reference data: Use SERVER_WINS to prevent stale data
  • For custom objects: Implement timestamp-based resolution

Network-Aware Syncing: Implement connectivity detection that adjusts sync behavior:

  • WiFi: Sync all queued records in large batches
  • Cellular: Sync only critical records in small batches
  • Poor connection: Queue only, don’t attempt sync

Queue Persistence and Recovery: Ensure your offline queue survives app crashes and force-quits:

  • Persist queue state to SmartStore after every change
  • Implement queue recovery on app launch
  • Add queue integrity checks to detect corruption

Monitoring and Alerting: Implement telemetry to track queue health:

  • Alert when queue exceeds 300 records
  • Track sync success rates by record type
  • Monitor average sync duration
  • Log conflict resolution outcomes

User Experience Improvements:

  • Show queue depth in the UI with visual indicators (green < 100, yellow < 300, red > 300)
  • Provide manual “Sync Now” button with progress indication
  • Display estimated sync time based on queue size and connection speed
  • Allow users to view and manage queued records

Testing Recommendations:

  1. Simulate extended offline periods (24+ hours)
  2. Test with 500+ queued records across multiple object types
  3. Verify data integrity after failed partial syncs
  4. Test concurrent modifications to the same records
  5. Validate queue recovery after app termination

The key is shifting from a single-point-of-failure sync model to a resilient, batched approach that prioritizes data preservation over immediate consistency. With these changes, your sales reps can work offline for extended periods without data loss risk.


This draft is based on general Salesforce knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.

The 200-record limit is actually a default configuration, not a hard system limit. You can increase it in your SyncManager initialization. Check your syncConfig settings and look for maxSyncQueueSize parameter. However, be careful - larger queues mean longer sync times and higher memory usage on mobile devices.

We dealt with this exact problem last year. The real issue isn’t just the queue size - it’s how you’re handling the sync strategy. Instead of letting the queue grow indefinitely, implement incremental syncing. Break large queues into batches of 50 records and process them sequentially. Also, prioritize certain record types - sync critical data like opportunities first, then less urgent records like activity history. This prevents the all-or-nothing failure scenario you’re experiencing.

Have you considered implementing a conflict resolution strategy? When large queues fail, it’s often because of data conflicts that accumulated during the offline period. The Mobile SDK’s SyncManager has options for conflict handling - you can set policies like SERVER_WINS, CLIENT_WINS, or CUSTOM. For sales scenarios, I’d recommend CLIENT_WINS for opportunity data to preserve field updates, but SERVER_WINS for reference data like price books.

Good point about conflict resolution. We’re currently using the default settings. I’ll look into the maxSyncQueueSize parameter and batch processing approach. Do you have any code examples for implementing incremental sync?

From an operations perspective, you should also educate your sales reps about manual sync triggers. Don’t rely solely on automatic sync when connectivity returns. Train them to manually initiate sync when they get back to WiFi areas, and to do it in stages if they’ve been offline for extended periods.

Another optimization: implement selective syncing based on record age and type. You don’t need to sync everything immediately. Use SyncManager’s syncDown and syncUp with custom SOQL queries that filter by priority. This reduces the initial sync load significantly.