{
  "id": "python/aiohttp-client-connector-ssl-certificate-error",
  "signature": "aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host example.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate')]",
  "signature_zh": "aiohttp.client_exceptions.ClientConnectorCertificateError: 无法连接到主机 example.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败：无法获取本地颁发者证书')]",
  "regex": "aiohttp\\.client_exceptions\\.ClientConnectorCertificateError:\\ Cannot\\ connect\\ to\\ host\\ example\\.com:443\\ ssl:True\\ \\[SSLCertVerificationError:\\ \\(1,\\ '\\[SSL:\\ CERTIFICATE_VERIFY_FAILED\\]\\ certificate\\ verify\\ failed:\\ unable\\ to\\ get\\ local\\ issuer\\ certificate'\\)\\]",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "The TLS handshake failed because the client's trust store does not contain the CA that signed the server certificate. Common on macOS with python.org installers or in containers missing ca-certificates.",
  "root_cause_type": "generic",
  "root_cause_zh": "TLS 握手失败，因为客户端信任库中没有签发服务器证书的 CA。常见于使用 python.org 安装包的 macOS，或缺少 ca-certificates 的容器。",
  "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": "Disables verification and exposes the app to MITM; also not accepted by all aiohttp versions in the same way.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Affects urllib, not aiohttp/ssl; the SSL context still verifies.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Same security problem as ssl=False, and does not fix the trust-store gap for other hosts.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "# macOS python.org\n'/Applications/Python 3.x/Install Certificates.command'\n# Debian/Ubuntu\napt-get install -y ca-certificates && update-ca-certificates\n# pip\npip install --upgrade certifi",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "import ssl, certifi\nctx = ssl.create_default_context(cafile=certifi.where())\nconn = aiohttp.TCPConnector(ssl=ctx)\nasync with aiohttp.ClientSession(connector=conn) as s:\n    ...",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "import ssl, truststore\ntruststore.inject_into_ssl()\n# then aiohttp uses the OS trust store automatically",
      "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-19",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}