# fatal error: sync: RUnlock of unlocked RWMutex

- **ID:** `go/fatal-error-sync-runlock-of-unlocked-rwmutex`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

RUnlock() is called without a matching RLock(), or the read lock was already released, corrupting the reader count.

## Version Compatibility

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

## Workarounds

1. **** (94% success)
   ```
   Pair defer mu.RUnlock() with mu.RLock() on the next line, and defer mu.Unlock() with mu.Lock(), never mixing them.
   ```
2. **** (90% success)
   ```
   Use a helper: func withReadLock(mu *sync.RWMutex, fn func()) { mu.RLock(); defer mu.RUnlock(); fn() }.
   ```

## Dead Ends

- **** — This sacrifices read concurrency and does not fix the missing RLock; if RUnlock is still called, it now mismatches Lock/Unlock. (70% fail)
- **** — Adds an extra lock that is never released, causing a permanent deadlock on the next writer. (90% fail)
