python network_error ai_generated partial

httpx.ConnectError: [SSL: SSL_HANDSHAKE_FAILURE] ssl handshake failure (_ssl.c:1123) while connecting to 'https://incompatible.example.com'

ID: python/httpx-connecterror-ssl-handshake-failure

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2025-12-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active

Root Cause

The client and server cannot agree on SSL/TLS parameters, often due to outdated protocols or cipher mismatches.

generic

中文

客户端和服务器无法就SSL/TLS参数达成一致,通常是由于过时的协议或密码套件不匹配。

Workarounds

  1. 90% success Update the server to support modern TLS versions (1.2 or 1.3)
    Contact server administrator to enable TLS 1.2 or higher.
  2. 80% success Configure the client to use a specific TLS version if supported
    import ssl
    context = ssl.create_default_context()
    context.minimum_version = ssl.TLSVersion.TLSv1_2
    client = httpx.Client(verify=context)
    response = client.get('https://incompatible.example.com')

Dead Ends

Common approaches that don't work:

  1. Disabling SSL verification 80% fail

    Handshake failure occurs before certificate verification.

  2. Using a very old SSL version 70% fail

    Old versions are often disabled for security reasons.