{
  "id": "python/httpx-connecterror-connection-reset-by-peer",
  "signature": "httpx.ConnectError: [Errno 104] Connection reset by peer while connecting to 'https://unstable.example.com'",
  "signature_zh": "httpx.ConnectError: [Errno 104] 连接被对端重置，连接到'https://unstable.example.com'时",
  "regex": "httpx\\.ConnectError:\\ \\[Errno\\ 104\\]\\ Connection\\ reset\\ by\\ peer\\ while\\ connecting\\ to\\ 'https://unstable\\.example\\.com'",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "The remote server abruptly closed the TCP connection, often due to server overload or network issues.",
  "root_cause_type": "generic",
  "root_cause_zh": "远程服务器突然关闭TCP连接，通常是由于服务器过载或网络问题。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Retrying immediately without any delay",
      "why_fails": "The server may still be overloaded, causing immediate reset again.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using a different HTTP version",
      "why_fails": "The issue is at the TCP level, not HTTP version.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Implement retry with exponential backoff and jitter",
      "success_rate": 0.85,
      "how": "import time, random\nfor i in range(3):\n    try:\n        response = httpx.get('https://unstable.example.com')\n        break\n    except httpx.ConnectError:\n        time.sleep(2 ** i + random.uniform(0, 1))",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a connection pool with keep-alive to reduce connection resets",
      "success_rate": 0.7,
      "how": "client = httpx.Client()\nresponse = client.get('https://unstable.example.com')",
      "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": "partial",
  "first_seen": "2025-10-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}