{
  "id": "go/grpc-client-conn-closed",
  "signature": "rpc error: code = Unavailable desc = grpc: the client connection is closing",
  "signature_zh": "rpc error: code = Unavailable desc = grpc: 客户端连接正在关闭",
  "regex": "rpc\\ error:\\ code\\ =\\ Unavailable\\ desc\\ =\\ grpc:\\ the\\ client\\ connection\\ is\\ closing",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The *grpc.ClientConn was closed (conn.Close()) while an RPC was in flight, or Close was called on a shared conn during shutdown while other goroutines still use it.",
  "root_cause_type": "generic",
  "root_cause_zh": "*grpc.ClientConn 在 RPC 进行中被关闭（conn.Close()），或在关闭期间对共享 conn 调用了 Close，而其他 goroutine 仍在使用它。",
  "versions": [
    {
      "version": "1.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Closes the shared connection after the first call; subsequent calls fail.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "A closed ClientConn cannot be reused; all calls fail immediately.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "var conn *grpc.ClientConn\nfunc Init() error {\n  var err error\n  conn, err = grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))\n  return err\n}\n// Close only at shutdown via signal handler",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "var wg sync.WaitGroup\nwg.Add(1)\ngo func() { defer wg.Done(); client.Do(ctx, req) }()\nwg.Wait()\nconn.Close()",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-07-19",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}