{
  "id": "go/grpc-server-stopped",
  "signature": "rpc error: code = Unavailable desc = grpc: the server has been stopped",
  "signature_zh": "rpc 错误：code = Unavailable，desc = grpc：服务端已停止",
  "regex": "rpc\\ error:\\ code\\ =\\ Unavailable\\ desc\\ =\\ grpc:\\ the\\ server\\ has\\ been\\ stopped",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A call was made against a grpc.Server after GracefulStop()/Stop() completed, or before Serve() started.",
  "root_cause_type": "generic",
  "root_cause_zh": "在 grpc.Server 的 GracefulStop()/Stop() 完成后，或在 Serve() 启动前发起了调用。",
  "versions": [
    {
      "version": "google.golang.org/grpc 1.50+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "grpc.Server cannot be restarted after Stop; you must construct a new one.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Hides a lifecycle bug where the server is being used after shutdown.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "Order shutdown correctly:\n// on SIGTERM\nsrv.GracefulStop() // stops accepting, drains in-flight\nlis.Close()\n// construct a fresh server on restart",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "Guard server lifecycle with sync.Once and a ready channel; only issue calls after Serve() has started (use a health check).",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}