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

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

## Root Cause

A goroutine dereferences a nil pointer, often a struct field or interface that was never initialized, and the panic occurs in a goroutine so the stack trace is asynchronous.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   Initialize all struct fields in the constructor and validate inputs before spawning goroutines.
   ```
2. **** (82% success)
   ```
   Add a recover that logs the stack via debug.Stack() before re-panicking or exiting, so the root cause is visible.
   ```

## Dead Ends

- **** — The nil pointer indicates a logic bug; swallowing it leaves the program in an inconsistent state and loses the stack trace. (85% fail)
