{
  "id": "python/aiohttp-client-connector-connection-error",
  "signature": "aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host example.com:80 ssl:default [Connection refused]",
  "signature_zh": "aiohttp 客户端连接器错误：无法连接到主机 example.com:80 ssl:default [连接被拒绝]",
  "regex": "aiohttp\\.client_exceptions\\.ClientConnectorError:\\ Cannot\\ connect\\ to\\ host\\ example\\.com:80\\ ssl:default\\ \\[Connection\\ refused\\]",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "The remote host actively refused the connection, either because no service is listening on that port or a firewall blocked it.",
  "root_cause_type": "generic",
  "root_cause_zh": "远程主机主动拒绝连接，可能是因为该端口上没有服务监听，或者防火墙阻止了连接。",
  "versions": [
    {
      "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": "Retrying with the same parameters indefinitely",
      "why_fails": "If the service is down, retrying won't help and may waste resources.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Changing the port to a common alternative without verification",
      "why_fails": "The service may not be running on the alternative port either.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check if the service is running and the port is open",
      "success_rate": 0.8,
      "how": "import socket\nsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nresult = sock.connect_ex(('example.com', 80))\nif result != 0:\n    print('Port is closed')",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a fallback URL or service discovery",
      "success_rate": 0.75,
      "how": "try:\n    async with session.get('http://example.com') as resp:\n        pass\nexcept aiohttp.ClientConnectorError:\n    async with session.get('http://backup.example.com') as resp:",
      "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.82,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-01-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}