{
  "id": "python/aiohttp-serverdisconnectederror",
  "signature": "aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected",
  "signature_zh": "aiohttp.client_exceptions.ServerDisconnectedError: 服务器断开连接",
  "regex": "aiohttp\\.client_exceptions\\.ServerDisconnectedError:\\ Server\\ disconnected",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "The remote server closed the TCP connection before sending a complete HTTP response, often due to keep-alive timeouts, load balancer idle limits, or server-side crashes.",
  "root_cause_type": "generic",
  "root_cause_zh": "远程服务器在发送完整 HTTP 响应之前关闭了 TCP 连接，通常由 keep-alive 超时、负载均衡器空闲限制或服务器崩溃引起。",
  "versions": [
    {
      "version": "3.9+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The disconnect is server-initiated, not a client timeout; longer timeouts just make failures slower.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If the server closes mid-response, disabling keep-alive does not prevent the in-flight disconnect.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.85,
      "how": "import aiohttp\n\nconnector = aiohttp.TCPConnector(limit=100, enable_cleanup_closed=True)\nasync with aiohttp.ClientSession(connector=connector) as s:\n    for attempt in range(3):\n        try:\n            async with s.get(url) as r:\n                return await r.text()\n        except aiohttp.ServerDisconnectedError:\n            continue",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "connector = aiohttp.TCPConnector(keepalive_timeout=15)\n# plus exponential backoff wrapper around the request",
      "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": "2024-05-08",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}