# fatal error: all goroutines are asleep - deadlock! (sync.Mutex.Lock on already-held lock)

- **ID:** `go/mutex-double-lock-self-deadlock`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The same goroutine calls Lock() twice on a non-reentrant sync.Mutex, or a locked method calls another method that locks the same mutex.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.18 | active | — | — |
| 1.22 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Split into exported methods that lock and unexported helpers that assume the lock is held; never call Lock inside a locked section
   ```
2. **** (85% success)
   ```
   Use defer mu.Unlock() consistently and audit call chains for re-entrancy
   ```

## Dead Ends

- **** — The goroutine itself holds the lock; retry never succeeds (90% fail)
- **** — RLock while holding RLock is allowed but Lock after RLock still deadlocks (75% fail)
