How to fix ENTITY_IS_DELETED in Salesforce deployments
The metadata or record the deployment references has been deleted, or sits in the Recycle Bin, in the target org.
Surfaces during: runtime DML and metadata deploys that reference a since-deleted componentWhat it means
ENTITY_IS_DELETED means the component or record your deployment expects to find has already been removed in the target org. This happens when metadata retrieved earlier is now stale, or when a destructive change and a dependent deployment run in the wrong order against each other.
It can fire at either layer: an Apex query or DML statement hitting a soft-deleted record still in the Recycle Bin, or a Metadata API deploy referencing a component that a prior destructiveChanges.xml already removed from the target org.
Common causes
The fix
- Re-sync before deployingRetrieve current metadata from the target org to confirm the component genuinely still exists there.
sf project retrieve start --target-org myOrgAlias --metadata CustomField:Account.Legacy_Score__c - Remove or restore the referenceDelete the stale reference from your metadata, or restore the component from the Recycle Bin if it should still exist.
- Sequence destructive changes correctlyDeploy dependent metadata changes first, then run destructive deletions afterward, following Salesforce's two-step destructive deploy pattern.
How Serpent prevents this
Serpent AI pulls live org state before every task and flags a deleted component as a diff conflict to resolve, instead of letting it fail mid-deploy. See the Salesforce deployment error library.

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