{
  "id": "go/grpc-unknown-non-status-error",
  "signature": "rpc error: code = Unknown desc = runtime error: invalid memory address or nil pointer dereference",
  "signature_zh": "rpc error: code = Unknown desc = 运行时错误：无效的内存地址或空指针解引用",
  "regex": "rpc\\ error:\\ code\\ =\\ Unknown\\ desc\\ =\\ runtime\\ error:\\ invalid\\ memory\\ address\\ or\\ nil\\ pointer\\ dereference",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The server handler panicked. gRPC recovers the panic and returns Unknown, but the panic message leaks into the error description. The real cause is a nil pointer dereference in the handler.",
  "root_cause_type": "generic",
  "root_cause_zh": "服务端处理程序发生 panic。gRPC 恢复 panic 并返回 Unknown，但 panic 消息泄漏到错误描述中。真正的根因是处理程序中的空指针解引用。",
  "versions": [
    {
      "version": "1.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The server will panic again for the same input; retries just amplify load and log noise",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The panic happened on the server; client-side recover cannot catch it",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "func recovery(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {\n  defer func() {\n    if r := recover(); r != nil {\n      log.Printf(\"panic in %s: %v\\n%s\", info.FullMethod, r, debug.Stack())\n    }\n  }()\n  return handler(ctx, req)\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "if req == nil || req.User == nil {\n  return nil, status.Error(codes.InvalidArgument, \"user is required\")\n}",
      "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": "2025-04-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}