# rpc error: code = Internal desc = panic: runtime error: invalid memory address or nil pointer dereference

- **ID:** `go/grpc-internal-server-panic`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Server-side code panics due to a nil pointer or other runtime error, causing an Internal error.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   func recoveryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
    defer func() { if r := recover(); r != nil { log.Printf("panic: %v", r); err = status.Errorf(codes.Internal, "internal error") } }()
    return handler(ctx, req)
}
   ```
2. **** (80% success)
   ```
   if req.User == nil { return nil, status.Error(codes.InvalidArgument, "user required") }
   ```

## Dead Ends

- **** — The bug will recur when the same condition is hit. (90% fail)
- **** — Without logs, you can't identify the root cause. (60% fail)
