← Back to Patterns
retry-exhaustion
Demonstrates various RETRY exhaustion behaviors (CONTINUE, STOP, GOTO, COMPLETE)
retries
Source
# RETRY Exhaustion Patterns
Demonstrates different behaviors when a step exhausts its retry count.
## 1. Exhaustion CONTINUE
- PASS: COMPLETE
- FAIL: RETRY 1 CONTINUE
Fails initially, retries once. If it fails again, it CONTINUES to the next step.
This allows "best effort" steps.
```bash
rd echo --result fail --result fail
```
## 2. Exhaustion STOP
- PASS: COMPLETE
- FAIL: RETRY 1 STOP
Fails initially, retries once. If it fails again, it STOPS the runbook.
This is for critical steps that must succeed eventually.
```bash
rd echo --result fail --result fail
```
## 3. Exhaustion GOTO
- PASS: COMPLETE
- FAIL: RETRY 2 GOTO 4
Fails up to 2 times. If it exhausts, it jumps to the Recovery step.
```bash
rd echo --result fail --result fail --result fail
```
## 4. Recovery
- PASS: COMPLETE
Recovery step reached from Step 3 exhaustion.
```bash
rd echo "recovered"
```
## 5. Exhaustion COMPLETE
- PASS: CONTINUE
- FAIL: RETRY 3 COMPLETE "Max retries reached, completing anyway"
Retries up to 3 times. If it still fails, it COMPLETES the runbook (success state).
Useful if the failure is acceptable as a final state.
```bash
rd echo "retry operation" --result fail --result fail --result pass
```
Try It
Exhaustion triggers CONTINUE, proceeds to next step
Initializing...
Initializing...
Step—/—
ExpectedCOMPLETE
Env idle