{
  "id": "python/aiohttp-server-disconnected",
  "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 response, often due to keep-alive timeouts, server-side crashes, or proxy interference.",
  "root_cause_type": "generic",
  "root_cause_zh": "远程服务器在发送完整响应之前关闭了 TCP 连接，通常是由于 keep-alive 超时、服务器端崩溃或代理干扰。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The disconnect is not caused by slowness; a longer timeout just delays the failure.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The error is at the TCP layer, not TLS; disabling SSL does not prevent the server from closing the connection.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Enable retries with exponential backoff using aiohttp's built-in retry or a custom decorator:\n\nfrom aiohttp_retry import RetryClient, ExponentialRetry\nretry_options = ExponentialRetry(attempts=3)\nasync with RetryClient(retry_options=retry_options) as client:\n    await client.get(url)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.7,
      "how": "Set a Connection: close header to avoid keep-alive reuse:\n\nheaders = {'Connection': 'close'}\nasync with session.get(url, headers=headers) as resp:\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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-03-22",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}