# fatal error: sync: unlock of unlocked mutex

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

## Root Cause

mu.Unlock() is called without a matching Lock(), often due to a double unlock or an early Unlock in a defer plus explicit Unlock.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   mu.Lock()
defer mu.Unlock()
// no other Unlock calls
   ```
2. **** (93% success)
   ```
   func (s *Store) withLock(fn func()) {
    s.mu.Lock()
    defer s.mu.Unlock()
    fn()
}
   ```

## Dead Ends

- **** — This is a fatal error; recover cannot catch it. (100% fail)
- **** — The flag itself needs synchronization and often races. (75% fail)
