{
  "id": "go/grpc-internal-server-panic",
  "signature": "rpc error: code = Internal desc = panic: runtime error: invalid memory address or nil pointer dereference",
  "signature_zh": "rpc 错误：代码 = Internal 描述 = 恐慌：运行时错误：无效的内存地址或空指针引用",
  "regex": "rpc\\ error:\\ code\\ =\\ Internal\\ desc\\ =\\ panic:\\ runtime\\ error:\\ invalid\\ memory\\ address\\ or\\ nil\\ pointer\\ dereference",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Server-side code panics due to a nil pointer or other runtime error, causing an Internal error.",
  "root_cause_type": "generic",
  "root_cause_zh": "服务器端代码因空指针或其他运行时错误而恐慌，导致 Internal 错误。",
  "versions": [
    {
      "version": "1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The bug will recur when the same condition is hit.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Without logs, you can't identify the root cause.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "func recoveryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {\n    defer func() { if r := recover(); r != nil { log.Printf(\"panic: %v\", r); err = status.Errorf(codes.Internal, \"internal error\") } }()\n    return handler(ctx, req)\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "if req.User == nil { return nil, status.Error(codes.InvalidArgument, \"user required\") }",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}