“The certificate for this server is invalid” (NSURLErrorDomain -1202) on Mac

The Mac does not trust the certificate that the server sent. The name, the chain or the site can be wrong.

Fix this with your agentCopies a prompt for Claude Code, Codex or any agent that can use Terminal.

My Mac has this problem: “The certificate for this server is invalid” (NSURLErrorDomain -1202) on Mac. Read https://kilobat.app/guides/nsurl-error-1202-certificate-for-this-server-is-invalid.md and work through it with me. Install the Kilobat CLI if it’s missing: brew install seifip/kilobat/kilobat. Run the guide’s Terminal and kilobat checks yourself and tell me what you find. List the steps only I can do. Ask before you change any setting.

Applies to: macOS 13 Ventura and later. The text was checked in CFNetwork on macOS 27.2.Checked: 29 October 2026

Symptoms

  • An app shows “The certificate for this server is invalid.”
  • Console shows NSURLErrorDomain Code=-1202.
  • The same site can open on another device or network.

Likely causes

  • The certificate lists another name. The name in the URL is not on the certificate.
  • A self-signed or incomplete chain. The Mac cannot link the certificate to a trusted authority.
  • A device on the network that replaces the certificate. A filter or proxy can do this. See Corporate proxy certificates break Terminal tools on a Mac.
  • A phishing or fake server. If the site is not yours, treat the warning as real.

How to check

  1. Show the certificate that the server sends.

    openssl s_client -connect example.com:443 -servername example.com </dev/null
  2. Compare the Mac date with another device. Use System Settings › General › Date & Time.

  3. Request the page and show each step of the connection.

    curl -v -o /dev/null https://example.com

How to fix it

  1. Check that the URL is the real address of the site.

  2. Try another network. If the error goes away, the first network replaces the certificate.

  3. If the server is yours, install a certificate that lists the host name, with the full chain.

  4. Do not trust a certificate for a site that you do not know.

With Kilobat

  1. Check Wi-Fi, the router, the internet, DNS and login pages in one step.

    kilobat diagnose
  2. If one site or service fails, find the layer that stops it.

    kilobat why example.com
  3. The CLI is free. In the app, the advice from these checks is part of Kilobat Pro. See Find why one site or API won't connect.

Questions

What does pretending mean?

The full message adds that you might be connecting to a server that is pretending to be the host. That can put confidential information at risk.

Can I ignore it?

Not for a site that handles passwords or payments.

Sources

  • Error text in CFNetwork.framework, macOS 27.2 (Localizable.loctable)
  • curl(1) and nc(1), man page installed with macOS 27.2

Checked on 29 October 2026.