{
  "id": "python/httpx-connect-error-all-connection-attempts-failed",
  "signature": "httpx.ConnectError: [Errno 111] Connection refused",
  "signature_zh": "httpx.ConnectError: [Errno 111] 连接被拒绝",
  "regex": "httpx\\.ConnectError:\\ \\[Errno\\ 111\\]\\ Connection\\ refused",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "The target host/port is not accepting TCP connections; server is down, wrong port, or blocked by firewall.",
  "root_cause_type": "generic",
  "root_cause_zh": "目标主机/端口未接受 TCP 连接；服务器已关闭、端口错误或被防火墙阻止。",
  "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"
    },
    {
      "version": "3.12+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Connection refused is immediate; timeouts are irrelevant.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The failure occurs before any HTTP exchange.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.85,
      "how": "import httpx, asyncio\nfor delay in (1, 2, 4, 8):\n    try:\n        async with httpx.AsyncClient() as c:\n            r = await c.get(url)\n        break\n    except httpx.ConnectError:\n        await asyncio.sleep(delay)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "transport = httpx.AsyncHTTPTransport(retries=3)\nasync with httpx.AsyncClient(transport=transport) as c:\n    r = await c.get(url)",
      "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.83,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2024-09-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}