# fatal error: all goroutines are asleep - deadlock! (mutex held by goroutine 1)

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

## Root Cause

A goroutine holds a mutex and waits for another goroutine that also needs the same mutex, causing a deadlock.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.0 | active | — | — |
| 1.23 | active | — | — |

## Workarounds

1. **** (85% success)
   ```
   Avoid holding mutexes while waiting for other resources. Use lock ordering or try-lock patterns.
   ```
2. **** (80% success)
   ```
   Use context.WithTimeout to break deadlocks by aborting the operation.
   ```

## Dead Ends

- **** — Sleep does not resolve the deadlock; the other goroutine is also blocked. (90% fail)
- **** — The deadlock is due to mutex, not channel; buffering does not help. (80% fail)
- **** — This introduces data races and may corrupt data. (70% fail)
