Loading
Feature Degradation | Agentforce Voice Read More

Salesforce Error 'Unable to lock row - Record currently unavailable'

Publish Date: May 19, 2026
Description

When a Salesforce record is being updated or created, a lock is placed on that record to prevent concurrent operations from causing data inconsistencies. These locks normally last a few seconds. However, a transaction can wait a maximum of 10 seconds for a lock to be released before timing out and throwing the "Unable to lock row - Record currently unavailable" error. Common triggers for this error include concurrent DML operations, Apex triggers, Bulk API imports, and Master-Detail relationship updates.

Resolution

Overview

To resolve "Unable to lock row" errors, identify which scenario below applies to your use case and follow the corresponding guidance. For a comprehensive reference on how and when Salesforce places record locks, consult the Salesforce Platform Record Locking and Concurrency documentation.

Scenario 1: Email-To-Case

When an email is processed by Email-to-Case, triggers on the EmailMessage object or related objects (such as the parent Account) attempt to lock those records. If another process already holds a lock on these records and the Email-to-Case processing must wait more than 10 seconds, a timeout occurs and this error is thrown.
Resolution: Review triggers on EmailMessage and related objects. Reduce trigger execution time where possible.

Scenario 2: Apex Triggers and API

When an After Insert Apex Trigger runs on a child record (such as a Task) related to a parent record (such as an Account), Salesforce locks the parent Account record during the child record creation. If the trigger runs for more than 10 seconds, any concurrent attempt to update the parent Account will fail with the locking error.
Example scenario:

  1. User A imports a Task via the Data Loader, assigning it to an existing Account. The Apex trigger fires.
  2. Two seconds later, User B manually edits the same Account and clicks Save.
  3. Salesforce cannot place a second lock on the Account (it is already locked by the Task creation). User B's transaction waits and times out after 10 seconds.

Resolution: Reduce the execution time of Apex triggers. Avoid or minimize the use of Locking Statements in triggers. Note: Apex Tests can also cause locks if run against production data.

Scenario 3: Bulk API

When inserting or updating records through the Bulk API, batches are processed in parallel by default. If two parallel batches contain records pointing to the same parent record, both batches attempt to lock the parent record simultaneously, which can cause the "unable to lock row" error.
Resolution: Use one or more of the following approaches:

  • Reduce the Bulk API batch size.
  • Process records in Serial mode instead of Parallel mode (one batch is processed at a time).
  • Sort records in each batch by parent record ID, so records sharing the same parent are grouped together and not split across parallel batches.

Scenario 4: Master-Detail Relationships

If a Master record has a very large number of Detail child records (thousands), editing any Detail record locks the Master record. With many child records being edited concurrently by users, the probability of lock contention on the Master record increases significantly.
Resolution: Reduce the number of child records on a single parent by distributing child records across multiple parent records. Review Record Level Locking strategies.

Troubleshooting Locked Records

  1. Enable debug logs for the user experiencing the error to identify the offending trigger, flow, or validation rule.
  2. Check for dependent background jobs running on the same object. If any are running, pause them and retry the operation to verify if the lock error is resolved.


 

Knowledge Article Number

000387767

 
Loading
Salesforce Help | Article