# panic: runtime error: invalid memory address or nil pointer dereference [recovered]

- **ID:** `go/nil-pointer-in-goroutine`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A goroutine attempts to access a nil pointer, often due to uninitialized variables or incorrect error handling.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   Initialize all pointers properly before use. Use the zero value or allocate memory with new().
   ```
2. **** (85% success)
   ```
   Use error returns to propagate nil pointers, and check errors before dereferencing.
   ```

## Dead Ends

- **** — This is tedious and may miss some cases; it does not address the root cause of why the pointer is nil. (60% fail)
- **** — Recovering does not fix the underlying issue; it may mask bugs and lead to inconsistent state. (70% fail)
- **** — It can cause data corruption or crashes in production; ignoring is not safe. (90% fail)
