How to fix CANNOT_UPDATE_CONVERTED_LEAD in Salesforce deployments
Apex or API code tries to update a Lead after it's already been converted, and Salesforce blocks the write.
Surfaces during: runtime DML, most often inside a trigger, batch job, or Apex testWhat it means
CANNOT_UPDATE_CONVERTED_LEAD fires when Apex or an API call attempts to update a Lead record that has already gone through conversion. Once converted, a Lead becomes read-only outside a small set of fields Salesforce still allows, so any other update is rejected rather than silently ignored.
It's a runtime error rather than a deploy-time one: the trigger or batch job itself deploys cleanly, and the failure only appears once the code actually executes against a converted record, commonly inside the Apex tests a production deployment requires.
Common causes
The fix
- Filter out IsConverted = true records before updating LeadsAdd IsConverted = false to any query or WHERE clause driving a bulk Lead update.
List<Lead> leads = [ SELECT Id, Status FROM Lead WHERE IsConverted = false AND Id IN :leadIds ]; update leads; - Add IsConverted checks to trigger logicGuard Lead trigger handlers so converted records are skipped rather than passed into update logic.
- Update the resulting record insteadOnce a Lead is converted, update the Contact, Account, or Opportunity it created rather than the original Lead.
How Serpent prevents this
Because Serpent runs the full Apex test suite on every task before it's eligible to merge, a trigger that doesn't filter out converted Leads fails as a test failure on the branch that introduced it, not on a production release. See the Salesforce deployment error library.

Prevention
Related errors
CANNOT_UPDATE_CONVERTED_LEAD, answered
Start free. No credit card, no install, no commitment.
Set up in under 15 minutes. No DevOps hire needed.
