System.DmlException: UNCOMMITTED_WORK_PENDING, Your call requires to be in an active transactionMixed DML operations. You tried to insert a User (Setup object) and an Account (non-Setup object) in the same transaction. Salesforce blocks this for data integrity reasons. You didn't know about the Setup/non-Setup separation rule.
3,100 developers search for this error every month. It's one of the most confusing Salesforce errors because the documentation is buried deep.
Salesforce enforces a strict separation between Setup objects (User, Profile, PermissionSet) and non-Setup objects (Account, Contact, Opportunity). You cannot perform DML on both types in the same transaction. This protects org security and metadata integrity.
Setup Objects
Cannot mix with non-Setup DML in same transaction:
Non-Setup Objects
Business data that conflicts with Setup DML:
Average time to debug this confusing error message
Static analysis tools that catch this pattern
Prevented when detected before deployment
This code looks perfectly logical. Create a user, create their account. What could go wrong?
// ❌ BAD: Mixed DML operations in same transaction
// Setup objects (User, Profile) mixed with non-Setup (Account)
public void createUserAndAccount() {
// Setup object DML
User newUser = new User(
FirstName = 'John',
LastName = 'Doe',
Email = 'john@example.com',
Username = 'john@example.com',
ProfileId = '00e...'
);
insert newUser; // Setup object
// Non-Setup object DML in same transaction
Account newAccount = new Account(
Name = 'Acme Corp'
);
insert newAccount; // ❌ CRASH!
// System.DmlException: UNCOMMITTED_WORK_PENDING
}Jataka's transaction analyzer detects Setup/non-Setup DML conflicts before execution.
Mixed DML Detected
Transaction contains DML on both Setup (User) and non-Setup (Account) objects. This will cause UNCOMMITTED_WORK_PENDING error.
Separate the DML operations into different transactions using async Apex.
// ✅ GOOD: Separate transactions using async
public void createUserAndAccount() {
// Setup object DML in current transaction
User newUser = new User(
FirstName = 'John',
LastName = 'Doe',
Email = 'john@example.com',
Username = 'john@example.com',
ProfileId = '00e...'
);
insert newUser;
// Non-Setup object DML in async transaction
Account newAccount = new Account(
Name = 'Acme Corp'
);
// Use Future method or Queueable
createAccountAsync(newAccount);
}
@future
public static void createAccountAsync(Account acc) {
insert acc; // Separate transaction - no conflict
}Result: Setup DML completes in main transaction. Non-Setup DML runs in separate async transaction. No conflict. Both operations succeed.
Catch confusing errors early
Book a demo and watch Jataka detect Setup/non-Setup conflicts automatically. Your developers learn the rule without the 2-hour debugging session.