"UNABLE_TO_LOCK_ROW: unable to obtain exclusive access to this record" — Why Your Bulk API Jobs Fail and How to Fix It
You're running a Bulk API job to update 90,000 Opportunities. It's 2am. The job finishes, and you see this: UNABLE_TO_LOCK_ROW: unable to obtain exclusive access to this record Not on one record. O...

Source: DEV Community
You're running a Bulk API job to update 90,000 Opportunities. It's 2am. The job finishes, and you see this: UNABLE_TO_LOCK_ROW: unable to obtain exclusive access to this record Not on one record. On thousands. Some records updated, others silently skipped. No retry. No recovery. Just a partial failure that nobody will notice until a VP asks why the pipeline numbers don't add up. I've hit this error on three separate projects over the past five years. The first time, I wasted two days trying to "fix" it with retry logic before realizing I was solving the wrong problem. This article is what I wish someone had handed me back then. If you search the Salesforce StackExchange, you'll find hundreds of threads on this error spanning over a decade. The core issue hasn't changed — and there's still no satisfying native solution. What Actually Happens: The 10-Second Death Window Salesforce uses pessimistic row locking on its multi-tenant database. When a transaction touches a record, it acquires