Try Serpent Free

How to fix ALL_OR_NONE_OPERATION_ROLLED_BACK in Salesforce deployments

One bad record in a batch submitted with allOrNone=true rolled back every record in that batch, valid ones included.

Surfaces during: bulk DML operations, data loads, and Apex test setup

What it means

ALL_OR_NONE_OPERATION_ROLLED_BACK means a DML operation was submitted with allOrNone set to true, and at least one record in the batch failed validation, so Salesforce rolled back the entire batch rather than committing the records that were individually valid. It's the expected behavior of allOrNone, not a bug, but it can be costly on large batches.

It shows up wherever bulk DML runs: a Database.insert(records, true) call in Apex, a Bulk API job with the allOrNone job option set, or a Data Loader session with "Insert null values" and partial-success both disabled. A single bad row anywhere in the batch takes the whole transaction down with it.

Diagnosis

Common causes

One record in a large batch fails validation
A bad picklist value, missing required field, or failed validation rule on a single record invalidates the whole allOrNone batch.
Mixed record types weren't pre-validated
A batch mixes records from different sources or shapes without checking each one against the object's validation rules first.
Batches weren't chunked
A large deployment's data step submits one very large batch instead of splitting it into smaller, more failure-isolated chunks.

The fix

  1. Validate records client-side before submission
    Check obvious failure conditions, required fields, picklist values, against the object's rules before sending the batch.
  2. Set allOrNone=false during migration passes
    Run migrations with allOrNone=false so individual failures don't block the rest of the batch, then review and fix the failed records.
  3. Chunk large batches into smaller groups
    Split a large data operation into smaller batches so a single bad record only affects a small subset of the total load.
    List<SObject> chunk = new List<SObject>();
    for (Integer i = 0; i < records.size(); i++) {
        chunk.add(records[i]);
        if (chunk.size() == 200 || i == records.size() - 1) {
            Database.insert(chunk, false);
            chunk.clear();
        }
    }
In practice

How Serpent prevents this

Serpent's data operations are chunked and validated as part of the pipeline, so a single bad record in a migration surfaces early against a small batch instead of rolling back a large one deep into a deployment. See the Salesforce deployment error library.

Release dashboard with conflict alerts in Serpent

Prevention

Default to allOrNone=false for bulk loads
Treat allOrNone=true as the exception for cases where partial success is truly unacceptable, not the default for every batch job.
Pre-validate before submission
Run incoming records through a lightweight schema check, required fields, picklist values, before they ever reach the DML call.
Design migrations with fixed chunk sizes from day one
Build data loads to submit in fixed-size chunks, 200 to 2,000 records, from the start instead of retrofitting chunking after a failure.
Common questions

ALL_OR_NONE_OPERATION_ROLLED_BACK, answered

Is allOrNone always the wrong setting to use?
No. It's the right choice when partial success is unacceptable, like a set of financial records that must post together; it's just expensive when used on large, loosely validated batches.
Does allOrNone=true roll back Apex trigger side effects too?
Yes. Salesforce rolls back the entire transaction, including any DML a trigger performed on other objects, not just the records submitted directly.
How do I find which specific record failed in a large batch?
The SaveResult array (or Bulk API job result) has one entry per submitted record, each with its own success flag and error list; loop through it to isolate the failure.

Start free. No credit card, no install, no commitment.

Set up in under 15 minutes. No DevOps hire needed.

Curious about faster shipping before you dive in? Let's talk

Commitment free!