{
  "id": "python/aiohttp-cannot-connect-to-host",
  "signature": "aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.example.com:443 ssl:default [Connect call failed]",
  "signature_zh": "aiohttp.client_exceptions.ClientConnectorError: 无法连接到主机 api.example.com:443 ssl:default [连接调用失败]",
  "regex": "aiohttp\\.client_exceptions\\.ClientConnectorError:\\ Cannot\\ connect\\ to\\ host\\ api\\.example\\.com:443\\ ssl:default\\ \\[Connect\\ call\\ failed\\]",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "DNS resolution or TCP connection to the target host failed, often due to network restrictions, wrong host/port, or firewall blocking outbound traffic.",
  "root_cause_type": "generic",
  "root_cause_zh": "对目标主机的 DNS 解析或 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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Connection is refused or unreachable; a longer timeout only delays the same error.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The failure occurs before the TLS handshake; ssl=False does not help when TCP connect fails.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Configure a proxy if the environment requires one:\n\nasync with aiohttp.ClientSession() as s:\n    async with s.get(url, proxy='http://proxy.local:8080') as r:\n        ...",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Verify DNS and connectivity first:\n\nimport socket\nsocket.gethostbyname('api.example.com')\n# then retry with aiodns resolver if needed",
      "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-07-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}