Claude Code · Certificates and network
SSL certificate has expired (CERT_HAS_EXPIRED)
Claude Code says the SSL certificate has expired (CERT_HAS_EXPIRED)? Check your clock, your proxy’s root and the CA file you gave Claude Code.
Message
The exact error
Unable to connect to API: SSL certificate has expiredAlso appears as:
- During /login
- SSL certificate error (CERT_HAS_EXPIRED). If you are behind a corporate proxy or TLS-intercepting firewall, set NODE_EXTRA_CA_CERTS to your CA bundle path, or ask IT to allowlist *.anthropic.com. Run `claude doctor` for details.
Meaning
What does CERT_HAS_EXPIRED mean?
Claude Code rejected the connection because a certificate in the chain ended before the time your computer reports. Anthropic renews its certificates well before they expire, so the cause is nearly always local: a clock set in the future, an old corporate root that expired, or a proxy that kept serving a certificate past its date. Since v2.1.199 Claude Code doesn’t retry a certificate failure, so the error appears on the first attempt.
Causes
Why does Claude Code say the certificate has expired?
- Your computer’s date is ahead (often the year)
- Your company’s proxy root or intermediate certificate has expired, or you pointed
NODE_EXTRA_CA_CERTSat an old copy - A local proxy or routing tool on your machine serving its own expired certificate
- An outdated certificate store on an old operating system
Fix
How do I find and fix the expired certificate?
Check your system clock first
Make sure the date, time and time zone are right and set automatically. The commands on the CERT_NOT_YET_VALID page apply here too.
Check which certificate expired
Open
https://api.anthropic.comin a browser on the same machine and inspect the certificate chain, or read the dates with OpenSSL.-showcertsprints the chain your network actually serves, so a proxy’s certificates show up there; the second command reads the end date of the CA file you gave Claude Code. AnotAfterdate in the past on a company certificate means IT needs to renew it.The chain your network serves openssl s_client -connect api.anthropic.com:443 -servername api.anthropic.com -showcerts </dev/nullYour CA file’s expiry date openssl x509 -in ~/corp-ca.pem -noout -enddateReplace the file NODE_EXTRA_CA_CERTS points to
Once IT has renewed the certificate, export the new root again (see the UNABLE_TO_GET_ISSUER_CERT_LOCALLY steps), replace the old file, use a full path in the variable, and restart Claude Code, which reads the file at startup.
Update your system’s certificates
Debian / Ubuntu sudo apt-get update && sudo apt-get install ca-certificatesmacOS and Windows Install pending operating system updates; root certificates update with the OS.
Don’t do this
- Don’t set
NODE_TLS_REJECT_UNAUTHORIZED=0. It switches off certificate checking entirely, so any machine on the network could read or change your traffic, including your API key.
Explained
What if my company’s proxy certificate expired?
On managed machines, the expired certificate is often the one your security proxy uses to re-sign HTTPS traffic. Nothing on your computer can fix that: the proxy’s administrator has to renew it. Until then, the same error appears in every tool that checks certificates. After the renewal, replace the file NODE_EXTRA_CA_CERTS points to with the new root and restart Claude Code. If the error names an unknown issuer instead, see UNABLE_TO_GET_ISSUER_CERT_LOCALLY; for a self-signed root, SELF_SIGNED_CERT_IN_CHAIN.
FAQ
Questions people ask
My browser works but Claude Code says the certificate has expired. Why?
Your browser may trust a newer copy of your company’s root from the system store, while Claude Code is also reading an old PEM file you gave it through NODE_EXTRA_CA_CERTS. Export the current root again, replace that file, use a full path, and restart Claude Code. If the proxy itself serves an expired certificate, only its administrator can renew it.
Can I see the expiry date from the command line?
Yes. Run openssl s_client -connect api.anthropic.com:443 -servername api.anthropic.com -showcerts and read the dates of each certificate in the chain, or for your CA file run openssl x509 -in corp-ca.pem -noout -enddate, which prints the notAfter date. A date in the past on a company certificate means IT needs to renew it.
Related
Related errors
Keep exploring