# fatal error: sync: unlock of unlocked mutex

- **ID:** `go/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 by this goroutine, due to double-unlock, unlock without lock, or copying a mutex value.

## Version Compatibility

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

## Workarounds

1. **** (96% success)
   ```
   mu.Lock()
defer mu.Unlock()
// critical section
   ```
2. **** (94% success)
   ```
   type Counter struct {
    mu sync.Mutex
    n  int
}
func inc(c *Counter) { c.mu.Lock(); defer c.mu.Unlock(); c.n++ }
   ```

## Dead Ends

- **** — This is a fatal runtime error, not a recoverable panic; the process aborts regardless. (98% fail)
- **** — This breaks the critical section semantics and can deadlock if the same goroutine already holds the lock. (85% fail)
