go auth_error ai_generated true

error: x509: certificate signed by unknown authority

ID: go/net-http-https-certificate-unknown-authority

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2026-09-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.20 active
1.21 active

Root Cause

The server's TLS certificate is not signed by a trusted Certificate Authority, often due to self-signed certificates.

generic

中文

服务器的TLS证书不是由受信任的证书颁发机构签名的,通常由于自签名证书。

Workarounds

  1. 95% success Add custom CA certificate to transport
    caCert, _ := os.ReadFile("ca.crt")
    caCertPool := x509.NewCertPool()
    caCertPool.AppendCertsFromPEM(caCert)
    transport := &http.Transport{TLSClientConfig: &tls.Config{RootCAs: caCertPool}}

Dead Ends

Common approaches that don't work:

  1. Setting InsecureSkipVerify to true globally 20% fail

    Security risk; use custom root CA instead.