Unclear Whether tls_cert_invalid, client_certificate and request_timeout can actually be returned as error kinds, or are only described, is not clear.
What
mTLS (mutual TLS) is a setup where Claude Code proves who it is to a server with a client certificate file, set with CLAUDE_CODE_CLIENT_CERT, and a private key file, set with CLAUDE_CODE_CLIENT_KEY. Several failures around it now get their own messages:
- When the server rejects the client certificate, Claude Code now reports a
client_certificateerror. IfCLAUDE_CODE_CLIENT_CERTis set, the message tells you to check that the files inCLAUDE_CODE_CLIENT_CERTandCLAUDE_CODE_CLIENT_KEYexist and haven't expired. If it is not set, the message says the server needs a valid client certificate andCLAUDE_CODE_CLIENT_CERTisn't set. - When a connection cannot be opened (
FailedToOpenSocket) andCLAUDE_CODE_CLIENT_CERTis set, the error now adds a hint thatCLAUDE_CODE_CLIENT_KEYmust match the certificate and needs the right passphrase. Before, this shared one message withENOTFOUNDandEAI_AGAIN. - The SDK's list of typed API error kinds, used by apps built on Claude Code, gains
unexpected_response. It covers a successful reply that is not a normal message, such as a proxy's sign-in page. The description also now mentionstls_cert_invalid,client_certificateandrequest_timeout, though onlyunexpected_responsewas seen added to the list of allowed values. - The
client_certificatedescription mentionsCLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION, the setting that controls whether Claude Code re-reads the certificate and key files and retries once.
Why
If you use Claude Code behind a gateway that needs a client certificate, a failed connection now points at the likely cause instead of a generic network error. Apps built on the SDK can also tell these failures apart and handle each one.
Whether `tls_cert_invalid`, `client_certificate` and `request_timeout` can actually be returned as error kinds, or are only described, is…