UNABLE_TO_LOCK_ROW: meaning and how to fix it
Quick answer
UNABLE_TO_LOCK_ROW: Two transactions tried to update the same or related records at once, so one timed out waiting for the lock, or they deadlocked. Roll-up summary fields and child records of the same parent are common causes because the parent is locked. Start with: Retry the failed operation; the error is often transient.
Typical message: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record
Cause
Two transactions tried to update the same or related records at once, so one timed out waiting for the lock, or they deadlocked. Roll-up summary fields and child records of the same parent are common causes because the parent is locked.
How to fix UNABLE_TO_LOCK_ROW
- Retry the failed operation; the error is often transient.
- In bulk loads, lower the batch size or switch to serial processing, and sort records by parent so batches do not compete for the same parent.
- Avoid running many jobs against the same parent record at the same time.
- In Apex, SOQL FOR UPDATE locks records on purpose; keep the transaction short.
Have a different message? Paste it into the error decoder, which matches it against 45 common Salesforce errors in your browser.
Frequently asked questions
What does UNABLE_TO_LOCK_ROW mean in Salesforce?
Two transactions tried to update the same or related records at once, so one timed out waiting for the lock, or they deadlocked. Roll-up summary fields and child records of the same parent are common causes because the parent is locked.
How do I fix UNABLE_TO_LOCK_ROW?
1. Retry the failed operation; the error is often transient. 2. In bulk loads, lower the batch size or switch to serial processing, and sort records by parent so batches do not compete for the same parent. 3. Avoid running many jobs against the same parent record at the same time. 4. In Apex, SOQL FOR UPDATE locks records on purpose; keep the transaction short.
More Data and DML errors
SFDX Talk is unofficial documentation. It is not affiliated with, endorsed by, or sponsored by Salesforce, Inc. Message text varies slightly by release and context, so confirm against the official page before relying on it.