Skip to content

Salesforce Row-Lock Errors in Data Loads: Causes and Fixes

UNABLE_TO_LOCK_ROW stalls Salesforce data loads when transactions wait too long for a record lock. Learn the causes, fixes, and prevention checklist.

Vantage Point article cover: Salesforce Row-Lock Errors in Data Loads: Causes and Fixes
Vantage Point article cover: Salesforce Row-Lock Errors in Data Loads: Causes and Fixes

Quick Answer

 

A row-lock error (UNABLE_TO_LOCK_ROW — "unable to obtain exclusive access to this record") means a transaction tried to update a Salesforce record that another transaction was already holding, and the lock was not released within Salesforce's roughly 10-second wait window. During bulk data loads it is the single most common cause of partial loads: parallel batches touch the same parent records and fail in waves. The fix is rarely exotic — run the load in serial mode or smaller batches, sort records by parent ID, quiet down automation and scheduled jobs during the load window, and retry the failed rows once the org is idle. This guide is for admins, developers, and consultants planning or rescuing a Salesforce data load, and it explains how Vantage Point's integration and data migration team approaches load design so row locks stop being a surprise.

Key Takeaways (TL;DR)

  • What is UNABLE_TO_LOCK_ROW? A concurrency error: Salesforce locks a record while it is being created or updated, and a second transaction that waits more than about 10 seconds for that lock fails with this error.
  • Why data loads trigger it: Bulk API and Data Loader process batches in parallel by default, so two batches updating child records of the same parent fight over the parent record's lock.
  • The fastest fix: switch the load to serial mode, cut batch size, and sort the file by parent record ID so contention disappears.
  • The quiet-org rule: pause overlapping scheduled jobs, flows, and user activity in the load window; locks are usually contention with something else running.
  • Bottom line: row-lock errors are a load-design problem, not a data problem. Failed rows are almost always safe to retry once the design is corrected.

What Is a Row-Lock Error in Salesforce?

Salesforce is a multi-tenant database, and it protects record integrity with locks. When a transaction creates or updates a record, Salesforce places a lock on that record — and often on related records, such as the parent Account when a child Task is inserted — until the transaction commits. A second transaction that needs the same record waits for the lock. If the wait exceeds roughly 10 seconds, Salesforce throws UNABLE_TO_LOCK_ROW and rolls the waiting transaction back.

Three properties of this error matter for planning:

  • It is transient. The record itself is fine. The same row usually succeeds on retry once the competing transaction finishes.
  • It is contagious in bulk. One hot parent record can fail hundreds of child rows across multiple batches, which is how a five-figure load can end with only a tenth of its rows committed.
  • It points somewhere else. The error names the victim record, but the cause is the other transaction — a trigger, a flow, a scheduled job, or a parallel batch. Fixing the load means finding that other transaction.

Why Row Locks Hit Data Loads Harder Than Everyday Use

In day-to-day use, row locks are rare because humans rarely edit the same record within the same 10 seconds. Data loads break that assumption in four ways:

  1. Parallel batches. Bulk API and Data Loader split the file into batches and process them in parallel by default. If batch 1 and batch 7 both contain child records of Account X, both try to lock Account X at the same time.
  2. Parent-record amplification. Inserting or updating a child record in a master-detail (and many lookup) relationships locks the parent. A migration loading 50,000 activities against 5,000 accounts is really 50,000 attempted locks on 5,000 shared parents.
  3. Automation multiplying lock time. Triggers, record-triggered flows, validation rules, and roll-up recalculations all run inside the transaction and hold locks longer. A trigger that takes 8 seconds turns every parent it touches into a lock hotspot.
  4. Background work. Sharing recalculations, scheduled flows, Apex jobs, and integrations keep running during the load unless someone stops them. They lock exactly the records the load is touching.

The Five Most Common Causes of UNABLE_TO_LOCK_ROW

Cause How it happens First fix to try
Parallel Bulk API batches Two batches contain rows sharing a parent or related record and lock it simultaneously. Switch to serial mode; sort the file by parent ID.
Apex triggers and flows Automation on the child or parent extends lock time past the 10-second window. Reduce trigger execution time; deactivate non-essential automation for the load window.
Master-detail and lookup locks Child DML locks the parent; roll-up summary fields force parent recalculation. Group child rows by parent; consider loading in parent-sized chunks.
Sharing recalculation Ownership changes or group updates trigger sharing recalcs that lock records and roles. Defer sharing rule recalculation until after the load.
Concurrent jobs and users Scheduled Apex, integrations, Email-to-Case, or users editing records during the load. Load off-hours; pause scheduled jobs; freeze integrations temporarily.

Salesforce's own row-lock error documentation walks through the same scenarios from the support side, including Email-to-Case and Apex trigger examples.

How to Rescue a Load That Is Already Failing

When a load comes back with thousands of row-lock failures, resist the urge to rerun the whole file. Work this sequence instead:

1. Stop the bleeding

Abort the job. Every additional parallel attempt adds more contention and more interleaved partial success, which makes reconciliation harder.

2. Split results into committed and failed

Pull the success and error files from the job. The failed file is your new input file — never reload rows that already committed, or you will trade lock errors for duplicates.

3. Confirm the error mix

Row-lock errors are retryable; validation errors, missing required fields, and malformed IDs are not. If the error file mixes types, separate them. Only the lock failures go into the retry file.

4. Quiet the org

Check Setup for running scheduled jobs, pause non-critical flows and integrations, and pick a window when users are offline. If a specific scheduled job overlaps the load every time, that is your lock partner.

5. Retry in serial mode with a smaller batch

Reload the retry file serially — one batch at a time — with a reduced batch size. Sort by parent record ID first so any remaining contention is inside a single batch, where Salesforce serializes it for you.

6. Reconcile counts before declaring victory

Compare source counts, committed counts, and remaining errors object by object. A load is done when every source row is accounted for, not when the job finishes.

How to Design the Next Load So Locks Never Appear

Rescue is expensive; prevention is cheap. Salesforce's Bulk API planning guidelines and hard-won migration practice point to the same checklist:

  • Use serial mode for contention-heavy objects. Activities, notes, and child records of shared parents load more reliably serially. Parallel mode is for lean, independent rows.
  • Sort every file by parent ID. This one habit eliminates most cross-batch contention.
  • Reduce batch size when you see locks. Smaller batches hold locks for less time and collide less often.
  • Defer sharing recalculation. If the load changes ownership at scale, defer sharing rules until the load completes.
  • Slim the automation surface. Temporarily deactivate flows and triggers that are not required for the load, and reactivate them immediately after with a smoke test.
  • Load off-hours. Schedule big jobs when users and scheduled jobs are idle.
  • Pilot in a sandbox. A 2,000-row representative sample surfaces lock hotspots, automation conflicts, and timing before the production window — the same discipline described in our API limits planning guide and our migration mapping document checklist.

Row Locks Outside Data Loads

The same error shows up in steady-state orgs: Email-to-Case colliding with triggers on the parent Account, integrations updating records a user is editing, or scheduled flows overlapping business hours. The triage is identical — find the competing transaction with debug logs, shorten it, or reschedule it. If row locks appear in normal operations, that is a signal the automation architecture needs review, not just the load plan.

What Businesses Should Do Next

Inventory where your org is exposed: heavy master-detail hierarchies, always-on integrations, scheduled jobs that touch the same objects you load into, and triggers that have never been timed. Then adopt the prevention checklist as a standard pre-load gate, and keep the rescue sequence documented so a failed load at 11 p.m. is a procedure, not a panic. If your team runs loads only occasionally, treat the first production-sized load as a rehearsal with a rollback plan and a retry file format agreed in advance.

How Vantage Point Helps

Vantage Point's senior consultants design and rescue Salesforce data loads as part of system integration and data migration engagements — from file preparation and load sequencing to automation quieting and post-load reconciliation. For orgs that hit row locks in day-to-day operations, our managed services team reviews trigger and flow performance, scheduled-job conflicts, and integration timing so the locks stop recurring. Senior consultants only — no junior handoffs; the experts you meet are the experts who deliver.

Planning a Big Salesforce Load?

 

If a migration or integration load is on your calendar, Vantage Point can review the load plan — file ordering, batch mode, automation window, retry procedure — before it runs, or step in when a load has already failed. Contact Vantage Point to schedule a working session, or explore our data migration services to see how we run loads that reconcile to the row.

Frequently Asked Questions

What does UNABLE_TO_LOCK_ROW mean in Salesforce?

It means a transaction tried to create or update a record that another transaction had already locked, and the lock was not released within roughly 10 seconds. Salesforce rolls back the waiting transaction and returns the error. The record itself is not corrupted — the operation simply lost a race and can almost always be retried.

Why do row-lock errors happen mostly during data loads?

Because bulk loads break the normal pattern of record access. Parallel batches, parent-record locking on child inserts, and automation running inside every transaction put far more simultaneous demand on the same records than human users ever do. The load is not creating a new problem so much as exposing contention that normal usage never triggers.

Does switching Bulk API to serial mode fix row-lock errors?

Usually, yes. Serial mode processes one batch at a time, which removes cross-batch contention — the most common cause of lock failures in loads. The trade-off is speed: serial loads run slower, so teams typically reserve serial mode for contention-heavy objects like activities and notes, and keep parallel mode for independent records.

What batch size should I use to avoid row locks?

There is no universal number — start with your tool's default and reduce it when locks appear, because smaller batches hold locks for less time and collide less often. Combine smaller batches with sorting the file by parent record ID, which matters more than the raw batch size in most orgs.

Can triggers or flows cause row-lock errors?

Yes. Triggers and record-triggered flows run inside the transaction and extend how long locks are held. A trigger that takes several seconds turns every record it touches into a lock hotspot, and flows that update parent records create the same contention parallel batches do. Deactivating non-essential automation during a load window is a standard prevention step.

Should I retry failed rows immediately after a row-lock error?

Not immediately, and not with the same settings. Retry only the failed rows — never the whole file — after you have removed the contention source: switch to serial mode, shrink batches, sort by parent ID, and confirm no scheduled job or integration is running. Retrying the full file in parallel usually reproduces the same failures.

How do I find which process is holding the lock?

Enable debug logs around the load window and look for long-running triggers, flows, and scheduled Apex that overlap the failures. Check Setup for scheduled jobs and paused or failed flow interviews at the same timestamps. Tools that surface job history help, but the correlation of failure timestamps with other running processes is what identifies the lock partner.

Sources


Vantage Point is a boutique CRM consulting firm helping businesses transform with Salesforce, HubSpot, and AI. Learn more at vantagepoint.io.

Salesforce

Want a second opinion on your Salesforce org?

Talk with a senior consultant about Financial Services Cloud, Agentforce, integrations or data. You get a straight answer on what to fix first, from someone who has done it in regulated firms.

Talk to a senior consultant

Not ready to talk? Get new articles on Salesforce, HubSpot and AI for regulated firms by email.

Latest Articles

Salesforce Row-Lock Errors in Data Loads: Causes and Fixes

UNABLE_TO_LOCK_ROW stalls Salesforce data loads when transactions wait too long for a record lock. Learn the causes, fixes, and prevention ...

Experience Cloud License Change: Preserve Permission Sets

Changing an Experience Cloud user's license can drop their permission sets. Learn why it happens and how to re-assign access automatically ...

Braze vs. Salesforce Marketing Cloud: A Consolidation Guide

Braze vs. Salesforce Marketing Cloud: compare operating models, integration overhead, and when consolidating onto Salesforce makes sense.