EPROTO node tls_error ai_generated true

Error: write EPROTO: SSL routines: wrong version number

ID: node/err-ossl-wrong-version-number

Also available as: JSON · Markdown
90%Fix Rate
90%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
20 active

Root Cause

HTTPS request sent to HTTP port, or proxy not handling TLS correctly.

generic

Workarounds

  1. 95% success Check the URL protocol — using https:// on an HTTP-only port
    // Wrong: https://localhost:3000  (if server is HTTP)
    // Right: http://localhost:3000

    Sources: https://nodejs.org/api/https.html

  2. 85% success If using a proxy, configure it to handle TLS: HTTPS_PROXY env var
    HTTPS_PROXY env var

    Sources: https://nodejs.org/api/tls.html

Dead Ends

Common approaches that don't work:

  1. Disable TLS verification: rejectUnauthorized: false 85% fail

    Security risk and doesn't fix the port/protocol issue

  2. Downgrade to HTTP 70% fail

    May expose sensitive data in transit

Error Chain

Frequently confused with: