Integration Error Handling Checklist

A working checklist for designing and reviewing how Salesforce integrations fail, retry, log and recover, with examples of error classification and partial-success handling.

Type
Resource
Topic
Resource
Reading time
3 min
Updated
Author
GeekMidst Team
Reviewed by
Site owner
Talk to an expert
Cover of the GeekMidst Integration Error Handling Checklist (checklist), listing sections: The checklist, Classifying common Salesforce errors, Reading a REST API error

Integrations rarely fail loudly. A token expires, a validation rule is added, a record is locked for a few seconds, and records stop arriving without anyone noticing until a customer complains. Good error handling is designed before go-live, not added after the first incident.

Use this checklist when designing a new integration with Salesforce, or when reviewing one that already runs. It applies whether the integration is point-to-point, runs through middleware, or uses platform events.

The checklist

  1. Every error is classified as transient (worth retrying) or permanent (needs a person or a code fix).
  2. Retries use backoff with jitter and a maximum number of attempts, so a struggling system is not hammered.
  3. Writes are idempotent. Use upsert on an External ID, or an idempotency key, so a retried request cannot create duplicates.
  4. Partial success is handled. Batch and composite calls can succeed for some records and fail for others; each record's result is checked.
  5. Failures are logged with context: source system, record identifier, payload reference, error code, message and timestamp, without logging secrets or unnecessary personal data.
  6. Failed messages are kept for replay, in a dead-letter queue or error table, with a tested way to resubmit them.
  7. Someone is alerted when error rates or queue depth cross a threshold, and the alert says where to look.
  8. API usage is monitored against your org's limits. Check current limits for your org in Salesforce Help or the System Overview page.
  9. Authentication failures are handled by refreshing tokens once, then alerting, rather than retrying indefinitely.
  10. There is a runbook that tells support staff how to diagnose, fix and replay each common failure.

Classifying common Salesforce errors

Typical causeRetry?Action
INVALID_SESSION_ID or HTTP 401Expired or revoked tokenOnce, after refreshRefresh the token, then alert if it fails again
REQUEST_LIMIT_EXCEEDEDAPI allocation used upLater, with backoffPause, alert and review call volume
UNABLE_TO_LOCK_ROWAnother process holds the recordYes, with backoffRetry a few times, then investigate data skew
HTTP 5xx or timeoutTemporary service or network issueYes, if the write is idempotentRetry with backoff and check for duplicates
REQUIRED_FIELD_MISSINGPayload lacks a mandatory valueNoRoute to the data owner and fix the source
FIELD_CUSTOM_VALIDATION_EXCEPTIONA validation rule rejected the dataNoRoute to the data owner or review the rule
DUPLICATE_VALUEA unique field already holds the valueNoCheck the External ID and matching logic

Reading a REST API error

The Salesforce REST API returns errors as a JSON array. The errorCode is what your classification logic should branch on; the message is for humans and may change wording.

json
[
  {
    "message": "Required fields are missing: [LastName]",
    "errorCode": "REQUIRED_FIELD_MISSING",
    "fields": ["LastName"]
  }
]
Example error body from the Salesforce REST API

Handling partial success in Apex

When Apex receives a batch of records from an inbound integration, using allOrNone = false lets valid records save while failed ones are captured. This sample assumes an Account.External_Id__c External ID field and a custom Integration_Error__c object with text fields for the identifier, status code and message. It is a pattern to adapt, not production code.

apex
public static void upsertAccounts(List<Account> records) {
    Database.UpsertResult[] results =
        Database.upsert(records, Account.External_Id__c, false);

    List<Integration_Error__c> errors = new List<Integration_Error__c>();
    for (Integer i = 0; i < results.size(); i++) {
        if (results[i].isSuccess()) {
            continue;
        }
        for (Database.Error err : results[i].getErrors()) {
            errors.add(new Integration_Error__c(
                Record_Key__c = records[i].External_Id__c,
                Status_Code__c = String.valueOf(err.getStatusCode()),
                Message__c = err.getMessage().left(255)
            ));
        }
    }
    if (!errors.isEmpty()) {
        insert errors;
    }
}
Capture per-record failures from a partial-success upsert

Worried about silent integration failures?

GeekMidst can review your existing integrations against this checklist, or design error handling and monitoring into a new one from the start.

Request an integration review →

Tell us what you are trying to fix.

Share your Salesforce setup, goals and constraints. A practitioner reads every message and replies with questions, first thoughts or an honest view of whether you need outside help at all.

Talk to a Salesforce Expert
Book a Consultation