• Claude Code

Claude Code: self signed certificate in certificate chain

Also seen in: the VS Code extension, Claude Desktop, WSL, MCP servers, the installer

In one sentence

Claude Code is several processes with several trust stores; find which one rejected the proxy's root, then give that store the root instead of switching verification off.

Where you see it

The CLI prints this when it cannot verify api.anthropic.com:

Unable to connect to API: Self-signed certificate detected (SELF_SIGNED_CERT_IN_CHAIN)

Its sibling Unable to connect to API: SSL certificate verification failed carries UNABLE_TO_GET_ISSUER_CERT_LOCALLY, and /login shows SSL certificate error (...). Since v2.1.273 the message carries the OpenSSL code and a NODE_EXTRA_CA_CERTS hint; before that it ended at Check your proxy or corporate SSL certificates. Since v2.1.199 it is reported at once, not after retries. The VS Code extension’s dictation and Web tab print Dictation error: WebSocket error:, the installer prints Failed to fetch version from downloads.claude.ai, and an MCP server fails in its own runtime’s words.

What it means

The code is OpenSSL’s: the certificate chain the process received ends in a self-signed certificate missing from the trust store that process reads. On a managed laptop that root is a TLS-inspecting proxy’s private CA, pushed into the OS store, so your browser accepts it. Claude Code crosses four trust paths in one session:

  1. The native binary (Bun): bundled Mozilla roots plus the OS store, per CLAUDE_CODE_CERT_STORE, plus NODE_EXTRA_CA_CERTS.
  2. Node-hosted parts: the VS Code extension’s dictation and Web tab, and older npm packages’ CLI, with Node’s bundled roots only.
  3. MCP stdio servers: child processes with their own store.
  4. The installer: the script downloads with curl or .NET and the OS store; the new binary then fetches the release version itself.

Likely causes

A TLS-inspecting proxy, and the native binary cannot find its root

Read the chain:

openssl s_client -connect api.anthropic.com:443 -servername api.anthropic.com </dev/null 2>/dev/null \
  | openssl x509 -noout -subject -issuer
subject=CN=api.anthropic.com
issuer=O=Example Corp, CN=Example Corp TLS Inspection CA

An issuer that is your employer confirms interception. Compare with curl, which reads the OS store:

curl -sSv https://api.anthropic.com/ -o /dev/null 2>&1 | grep -E 'issuer:|certificate problem'

If curl fails too, install the root in the OS store (Linux, macOS, Windows) and leave CLAUDE_CODE_CERT_STORE at its default of bundled,system, the default since 2.1.101.

If curl succeeds and claude fails, the failing process reads a different store. claude --debug logs CA certs: Appended extra certificates from NODE_EXTRA_CA_CERTS (/path/to/ca.pem), or Failed to read or Failed to load for a bad path, in ~/.claude/debug/<session-id>.txt; /status does not check the file.

Otherwise export the proxy root as PEM for NODE_EXTRA_CA_CERTS. Windows (DER out, then PEM):

Get-ChildItem Cert:\LocalMachine\Root | Where-Object Subject -like '*Example Corp*' |
  Select-Object -First 1 | Export-Certificate -FilePath C:\certs\proxy-root.cer
certutil -encode C:\certs\proxy-root.cer C:\certs\proxy-root.pem

macOS:

security find-certificate -a -c "Example Corp" -p /Library/Keychains/System.keychain > ~/proxy-root.pem

Linux: the merged bundle, /etc/ssl/certs/ca-certificates.crt (Debian, Ubuntu) or /etc/pki/tls/certs/ca-bundle.crt (Fedora, RHEL). Set it in the env block of ~/.claude/settings.json, which reaches every background-agent session, with CLAUDE_CODE_CERT_STORE beside it.

{
  "env": {
    "NODE_EXTRA_CA_CERTS": "/etc/ssl/certs/ca-certificates.crt"
  }
}

They do not stack:

Setting Affects Effect
CLAUDE_CODE_CERT_STORE binary base stores: bundled, system, both
NODE_EXTRA_CA_CERTS binary, Node, extension one PEM file, read at launch
NODE_USE_SYSTEM_CA=1 Node adds the OS store; undocumented for Claude Code
NODE_OPTIONS=--use-system-ca Node adds, Claude Code replaces keeps only the OS store; public sites fail

The npm-installed CLI or the VS Code extension runs on Node

The VS Code chat panel uses the extension’s bundled binary: the fix above covers it. Dictation and the Web tab read NODE_EXTRA_CA_CERTS from env in ~/.claude/settings.json and need extension version 2.1.307 or later; only that file or the environment VS Code started with reaches them, and the environment wins.

For a claude on your own Node, set NODE_EXTRA_CA_CERTS or NODE_USE_SYSTEM_CA=1 (added in v22.19.0 and v24.6.0); an npm install reads the OS store only on Node 22.15 or later. Leave NODE_OPTIONS=--use-system-ca out: a maintainer confirmed on issue #72066 that Claude Code then drops its bundled roots and keeps only the OS store, and the changelog records no fix as of 24 October 2026, with the regression last reproduced on 2.1.252. See VS Code and Cursor.

The settings file or a Desktop subprocess did not pass the variable on

Reported, never documented: the env block’s NODE_EXTRA_CA_CERTS had no effect while /status showed it set (#22512); WebFetch ignored it behind Zscaler until NODE_USE_SYSTEM_CA=1 (#25977); Claude Desktop’s Code tab passed only PATH to its CLI child (#22559). If the log shows nothing loaded, export it in your shell instead. Since v2.1.217 a Desktop session the app connects for reads them from managed settings and ~/.claude/settings.json only: use the user file.

An MCP stdio server is a child process; its env block, or --env NODE_EXTRA_CA_CERTS=/path/ca.pem on claude mcp add, is the documented way to hand it variables, and a shell export is not guaranteed to reach it. Other languages need their own variable: MCP servers behind a corporate proxy.

WSL, Docker or a dev container cannot see the Windows store

Linux inside WSL or a container cannot see the host’s store, so copy the exported root in and install it:

sudo cp /mnt/c/certs/proxy-root.pem /usr/local/share/ca-certificates/proxy-root.crt
sudo update-ca-certificates

In a dev container, COPY the file in the Dockerfile, set NODE_EXTRA_CA_CERTS in containerEnv and edit ~/.claude/settings.json on the remote system: the laptop’s copy is never read there. Docker x509 unknown authority covers the daemon’s own pulls.

The installer’s second step fetches with the new binary

The script’s download uses the OS store and succeeds; claude install then fetches the release version from downloads.claude.ai (or storage.googleapis.com on versions before 2.1.116) with the binary’s own client, the step issue #22756 shows failing. Install the root in the OS store first, or use a package (apt, dnf, apk, Homebrew, WinGet) the proxy lets through.

Check yours

Try it: Chain checkerOpen the full tool

Runs in your browser. Nothing you paste is sent anywhere.

Every certificate the server sends, leaf first. The output of openssl s_client -showcerts -connect example.com:443 works as it is: we ignore the text around the certificates.

Paste every certificate from openssl s_client -showcerts; the checker names the root and flags known HTTPS-inspection products.

Learn why

Guided mission · free · no account · progress saves hereChoose the root your client trusts — 6 minutesTry different trust stores and see why a self-signed root does not choose its own authority.

Does your team keep hitting this?

Everyone can use the lessons. Team seats add earned credentials, invitations and a completion report, so you see who has finished.

See team training

Early edition. Written with AI assistance and checked against primary sources; an independent expert review is planned. Found a mistake? Tell us.

Last reviewed Edition 0.9