nats-io/nats-server · error

client not OCSP valid

Error message

client not OCSP valid

What it means

The VerifyConnection callback installed by plugClientTLSOCSPPeer rejected an inbound client TLS connection: the client's verified certificate chain failed OCSP peer validation (tlsClientOCSPValid returned false). An OCSP peer reject event is emitted and the handshake fails with this error.

Solutions

  1. Ensure client certificates have valid, non-revoked OCSP status from a reachable responder
  2. Re-issue the client certificate if its OCSP status is revoked or unknown
  3. Relax or disable OCSP peer verification on the listener if not required
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/ocsp_peer.go:176 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02). Data as JSON: /api/errors/6edb64867ba5e757. Report an issue: GitHub.

Appendix: source

Thrown at server/ocsp_peer.go:176

		return s.plugServerTLSOCSPPeer(config)
	}
	return nil, false, nil
}

func (s *Server) plugClientTLSOCSPPeer(config *tlsConfigKind) (*tls.Config, bool, error) {
	if config == nil || config.tlsConfig == nil || config.tlsOpts == nil {
		return nil, false, errors.New(certidp.ErrUnableToPlugTLSClient)
	}
	tc := config.tlsConfig
	tcOpts := config.tlsOpts
	kind := config.kind
	if tcOpts.OCSPPeerConfig == nil || !tcOpts.OCSPPeerConfig.Verify {
		return tc, false, nil
	}
	tc.VerifyConnection = func(cs tls.ConnectionState) error {
		if !s.tlsClientOCSPValid(cs.VerifiedChains, tcOpts.OCSPPeerConfig) {
			s.sendOCSPPeerRejectEvent(kind, peerFromVerifiedChains(cs.VerifiedChains), certidp.MsgTLSClientRejectConnection)
			return errors.New(certidp.MsgTLSClientRejectConnection)
		}
		return nil
	}
	return tc, true, nil
}

func (s *Server) plugServerTLSOCSPPeer(config *tlsConfigKind) (*tls.Config, bool, error) {
	if config == nil || config.tlsConfig == nil || config.tlsOpts == nil {
		return nil, false, errors.New(certidp.ErrUnableToPlugTLSServer)
	}
	tc := config.tlsConfig
	tcOpts := config.tlsOpts
	kind := config.kind
	if tcOpts.OCSPPeerConfig == nil || !tcOpts.OCSPPeerConfig.Verify {
		return tc, false, nil
	}
	tc.VerifyConnection = func(cs tls.ConnectionState) error {
		if !s.tlsServerOCSPValid(cs.VerifiedChains, tcOpts.OCSPPeerConfig) {

View on GitHub (pinned to 3a66a489d2)