Too many SOQL queries 101.

The classic SOQL-in-a-for-loop. Works in Sandbox with 10 records — crashes Production at 1,000+.

The limit.

System.LimitException: Too many SOQL queries: 101

Salesforce allows 100 SOQL queries per transaction. Hit 101 and the entire transaction rolls back. In a trigger, every record in the batch fails.

100

Max SOQL queries per transaction

101

The query that crashes Production

4 hrs

Average downtime from this error

Bad vs good.

AccountTriggerHandler.clsAnti-pattern
// ❌ BAD: SOQL inside a for loop
// This works in Sandbox with 10 records
// Crashes in Production with 1,000+ records

public void processAccounts(List<Id> accountIds) {
    for (Id accId : accountIds) {
        // Each iteration runs a query!
        List<Contact> contacts = [
            SELECT Id, Name, Email
            FROM Contact
            WHERE AccountId = :accId
        ];
        
        // Process contacts...
        for (Contact c : contacts) {
            c.Email = c.Email.toLowerCase();
        }
        update contacts;
    }
}
AccountTriggerHandler.clsFixed
// ✅ GOOD: Bulkified query
// One query for all accounts

public void processAccounts(List<Id> accountIds) {
    // Single query outside the loop
    List<Contact> allContacts = [
        SELECT Id, Name, Email, AccountId
        FROM Contact
        WHERE AccountId IN :accountIds
    ];
    
    // Process in memory
    for (Contact c : allContacts) {
        c.Email = c.Email.toLowerCase();
    }
    
    // Single update
    update allContacts;
}

The fix.

Bulkify: query once with IN :accountIds, process in memory, then a single DML update. Jataka executes the PR against production-like volumes and blocks the merge when measured SOQL exceeds the limit.

Catch this before production.

Book a pilot and watch Jataka block this exact anti-pattern on your next PR.