# panic: sync: unlock of unlocked mutex

- **ID:** `go/panic-sync-unlock-of-unlocked-mutex`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

sync.Mutex.Unlock() is called on a mutex that is not currently locked, often due to double Unlock or a missing Lock.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Use defer mu.Unlock() immediately after Lock() to ensure pairing:
mu.Lock()
defer mu.Unlock()
   ```
2. **** (85% success)
   ```
   Review all Lock/Unlock pairs and ensure they are balanced. Consider using sync.RWMutex if read-heavy.
   ```

## Dead Ends

- **** — Hides the bug but does not fix the incorrect locking logic; may cause deadlocks later. (80% fail)
- **** — Channels have different semantics and may not fit the use case; also more complex. (60% fail)
