bad end line SSL / TLS Origin: Network OSI layer 6 · Presentation Last updated 18 Nov 2026

PEM routines: bad end line / no start line — Windows CRLF line endings or truncated PEM file

OpenSSL can't parse a PEM file because it has Windows line endings, missing newlines or a damaged BEGIN/END line.

Exact message you may see PEM routines:PEM_read_bio:bad end linebad end line PEMerror:0909006C:PEM routines:get_name:no start linePEM_read_bio_X509_AUX bad end lineCRLF PEM file
Seen on: OpenSSL SSL Windows

Meaning

Convert line endings (dos2unix cert.pem), make sure each -----BEGIN and -----END line is on its own line, and that the file wasn't copied through a rich-text editor. Wrapped/unwrapped base64 at 64 chars also matters for strict parsers.

Common causes

  • CRLF line endings
  • Certificate pasted from a rich-text editor
  • Missing newline after the END line
  • Extra characters/quotes around the PEM
  • Truncated copy

⚡ Quick fix

  1. dos2unix cert.pem
  2. Re-copy the PEM as plain text
  3. Check with openssl x509 -in cert.pem -noout -text

Detailed fix by platform

Shell

  1. bash
    dos2unix cert.pem
    file cert.pem
    head -1 cert.pem; tail -1 cert.pem

How to diagnose

  1. Line endings — LF?
  2. BEGIN/END — Intact?
  3. Editor — Plain text?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Network. Errors that are often confused with or caused by this one (click to open):

ACM region — CloudFront can't use my ACM certificate: it must be requested in us-east-1 (N. Virginia) (SSL / TLS)ACM regionbare LF — SMTP rejects bare line feeds: 550 5.6.11 SMTPSEND.BareLinefeedsAreIllegal / Bare LF not allowed (SMTP smuggling defence) (Email / SMTP)bare LFchain order — Certificate chain in the wrong order: PEM bundle must start with the leaf, then intermediates (SSL / TLS)chain orderDjango — Django send_mail: ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] (EMAIL_USE_SSL vs EMAIL_USE_TLS on the wrong port) (Email / SMTP)DjangoHAProxy — HAProxy: unable to load SSL private key from PEM file / no certificate found (crt bundle format) (SSL / TLS)HAProxyno start line — OpenSSL: unable to load certificate / PEM routines:get_name:no start line (key values mismatch) (SSL / TLS)no start lineopenssl.cnf — OpenSSL: Can't open openssl.cnf for reading / error loading config file (SSL / TLS)openssl.cnfSSL_CTX_use_PrivateKey_file failed (key values mismatch) — Nginx: [emerg] SSL_CTX_use_PrivateKey_file("/etc/ssl/server.key") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch) (SSL / TLS)SSL_CTX_use_PrivateKe…bad end l…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.