Every Apex developer meets this bug once: the trigger that worked all through development, then failed the first time someone imported a spreadsheet.
The limit is the transaction
Governor limits are counted per transaction, not per record. A trigger that runs one query per record does not use one query — it uses as many queries as the data load has rows, and the platform stops it at 101.
Counting the wrong thing
The instinct is to count records. The platform counts statements, and the difference is the entire lesson.
The fix is a pattern
Collect the ids first, query once, put the results in a map, then loop. It is three lines longer and it does not care whether the load is one record or two hundred.
Map<String, Id> queues = queueMap();for (Case c : cases) { c.OwnerId = queues.get(c.Origin);}
Testing it honestly
A test that inserts one record proves nothing about the case that broke. Insert two hundred.
Next in the series: what actually counts against each limit, and how to read the debug log that tells you.