# fatal error: concurrent map read and map write

- **ID:** `go/fatal-error-concurrent-map-read-and-map-write`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

One goroutine reads a map while another writes it, without a lock; the runtime detects the unsafe access pattern and aborts.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.17 | active | — | — |
| 1.20 | active | — | — |
| 1.23 | active | — | — |

## Workarounds

1. **** (96% success)
   ```
   var mu sync.RWMutex
mu.RLock()
v := m[k]
mu.RUnlock()
mu.Lock()
m[k] = v2
mu.Unlock()
   ```
2. **** (90% success)
   ```
   var m sync.Map
m.Load(k)
m.Store(k, v)
   ```

## Dead Ends

- **** — Copying itself iterates the map while it is written, still triggering the fatal error. (85% fail)
- **** — Reads still race with writes; the runtime aborts on the read/write overlap. (90% fail)
