# fatal error: concurrent map read and map write

- **ID:** `go/data-race-on-map`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Multiple goroutines access a map concurrently without synchronization, causing a runtime fatal error.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Use sync.RWMutex to protect reads and writes to the map.
   ```
2. **** (90% success)
   ```
   Use sync.Map which is safe for concurrent use.
   ```

## Dead Ends

- **** — It can cause crashes or data corruption; ignoring is not safe. (90% fail)
- **** — If not all accesses are protected, the race can still occur. (40% fail)
- **** — Copying is expensive and does not solve the root race condition. (70% fail)
