Claude Code · Certificates and network
SSL certificate is not yet valid (CERT_NOT_YET_VALID)
Claude Code says the SSL certificate is not yet valid (CERT_NOT_YET_VALID)? Your clock is almost always behind. Sync it on Windows, macOS, Linux or WSL.
Message
The exact error
Unable to connect to API: SSL certificate is not yet validAlso appears as:
- During /login (OAuth error)
- OAuth error: SSL certificate error (CERT_NOT_YET_VALID). 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_NOT_YET_VALID mean?
Certificates are valid between two dates. This error means the current time on your computer is before the certificate’s start date. Anthropic’s certificates aren’t issued in the future, so the usual culprit is a clock that’s behind: a laptop with a dead battery, a virtual machine restored from a snapshot, or a dual-boot system with mismatched time settings. Less often, a proxy issues a fresh certificate and your clock is a few minutes behind it.
Causes
Why is my certificate not yet valid?
- Your computer’s date or time is behind (check the year too)
- A virtual machine, container or WSL instance whose clock drifted after sleep or snapshot restore
- A TLS-inspecting proxy minting certificates that start a moment after your slightly slow clock
- A Raspberry Pi or similar board without a battery-backed clock that booted without network time
Fix
How do I fix CERT_NOT_YET_VALID?
Check the clock first
Compare the output with a clock you trust, such as your phone, and check the year and time zone as well as the time. If the date is wrong, fix time sync before anything else.
macOS, Linux and WSL dateWindows PowerShell Get-DateSet the clock automatically
On Windows you can also use Settings › Time & language › Date & time › Sync now. On WSL, restarting it with
wsl --shutdownfrom Windows usually brings its clock back in line.Windows (PowerShell as administrator) w32tm /resyncLinux and WSL timedatectl set-ntp true datemacOS System Settings › General › Date & Time › turn on “Set time and date automatically”Check the date the error mentions
Open
https://api.anthropic.comin a browser on the same machine. If the browser shows the same certificate date error, the clock is the problem; if it loads normally, look at a proxy between Claude Code and the internet.If the clock is right, talk to whoever runs the proxy
A proxy that issues certificates starting exactly now can trip clocks that are slightly behind. Your IT team can backdate the certificates it issues by a few minutes, or exclude
*.anthropic.comfrom inspection.
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.
FAQ
Questions people ask
How do I check what time my computer thinks it is?
Run date on macOS, Linux or WSL, or Get-Date in PowerShell, and compare it with a clock you trust. Check the year and the time zone as well as the time. In WSL, compare its date with Windows: a WSL clock that drifted after the laptop slept is common, and running wsl --shutdown from Windows resets it.
Can CERT_NOT_YET_VALID happen when my clock is right?
Yes, occasionally. A TLS-inspecting proxy that issues certificates starting at the exact current moment can trip a clock that is only slightly behind. If your clock is correct and the browser loads api.anthropic.com normally, ask IT to backdate the certificates the proxy issues by a few minutes, or to exclude *.anthropic.com from inspection.
Related
Related errors
Keep exploring