# panic: runtime error: invalid memory address or nil pointer dereference (in goroutine)

- **ID:** `go/panic-runtime-error-invalid-memory-address-nil-pointer-in-goroutine`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A goroutine dereferences a nil pointer; because it runs in a background goroutine, the panic crashes the whole program.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   go func() {
    defer func() {
        if r := recover(); r != nil {
            log.Printf("panic: %v", r)
        }
    }()
    doWork()
}()
   ```
2. **** (93% success)
   ```
   if p == nil {
    return fmt.Errorf("nil receiver")
}
   ```

## Dead Ends

- **** — Panic happens in a child goroutine; recover in main never sees it. (95% fail)
- **** — Any unhandled panic in a goroutine terminates the process. (90% fail)
