UNABLE_TO_LOCK_ROW

Salesforce could not get an exclusive lock on a record within about 10 seconds. The message reads unable to obtain exclusive access to this record.

Common causes

  • Two transactions update the same record, or children of the same parent, at the same time.
  • Bulk API parallel mode splits children of one parent across batches.
  • Data skew: one account with more than 10,000 children, or one user owning a very large number of records.
  • Roll-up summary fields and master-detail relationships lock the parent on every child save.
  • Slow triggers or flows hold locks for a long time.
  • Scheduled jobs overlap with integrations or each other.

How to fix

  • Sort load files by parent ID so each parent’s children land in the same batch.
  • Use serial mode in Bulk API, or reduce the batch size.
  • Reschedule jobs so they do not run at the same time.
  • Add retry logic to integrations. A retry a few seconds later usually succeeds.
  • Reduce skew by spreading children across more parents or owners.
  • Shorten transactions by removing unnecessary automation from the object.

You may also like...