## TL;DR

A trigger updated records that fired the trigger again, past 16 levels deep. Find the recursion (trigger updating its own object) and add a static guard flag.

## Error

```text
MAXIMUM_TRIGGER_DEPTH_EXCEEDED
```

## Steps

1. Find the trigger that updates the same object it fires on Expected: you locate the recursion.
2. Add a static boolean guard so the trigger body runs once per transaction Expected: recursion stops.
3. Re-run the operation Expected: it succeeds.
4. Add a test that updates the object twice in one transaction Expected: it cannot regress.

## When to use

- MAXIMUM_TRIGGER_DEPTH_EXCEEDED
- A trigger recurses

## When not to use

- No trigger recursion (then check flows and process builders too)
- The depth comes from legitimate chaining (then redesign the chain)

## Tool compatibility

- Salesforce trigger recursion guards
- Apex triggers

## Variant phrasings

### maximum trigger depth exceeded

A trigger fires itself. Add a static guard flag.

### trigger depth 16

Same: find the self-updating trigger.

## Why it happens

Workflow field updates re-fire triggers, and two triggers can ping-pong. Agents that generate triggers rarely add recursion guards.

## Edge cases

- Static variables reset between transactions, not within them; that is the point
- Also guard against flow-triggered recursion

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_v5ETWynt3Z53ichsgS552Q
