nats-io/nats-server · error
failed to parse OCSP response from %s peer: %w
Error message
failed to parse OCSP response from %s peer: %w
What it means
Peer-verification callback: the stapled OCSP bytes could not be parsed for the specific peer leaf and issuer (ocsp.ParseResponseForCert failed — malformed response, wrong serial, or bad signature). The library/parse error is wrapped.
Source
Thrown at server/ocsp.go:507
return fmt.Errorf("%s peer missing OCSP Staple", kind)
}
// Peer connections will verify the response of the staple.
if len(s.VerifiedChains) == 0 {
return fmt.Errorf("%s peer missing TLS verified chains", kind)
}
chain := s.VerifiedChains[0]
peerLeaf := chain[0]
peerIssuer := certidp.GetLeafIssuerCert(chain, 0)
if peerIssuer == nil {
return fmt.Errorf("failed to get issuer certificate for %s peer", kind)
}
// Response signature of issuer or issuer delegate is checked in the library parse
resp, err := ocsp.ParseResponseForCert(oresp, peerLeaf, peerIssuer)
if err != nil {
return fmt.Errorf("failed to parse OCSP response from %s peer: %w", kind, err)
}
// If signer was issuer delegate double-check issuer delegate authorization
if resp.Certificate != nil {
ok := false
for _, eku := range resp.Certificate.ExtKeyUsage {
if eku == x509.ExtKeyUsageOCSPSigning {
ok = true
break
}
}
if !ok {
return fmt.Errorf("OCSP staple's signer missing authorization by CA to act as OCSP signer")
}
}
// Check that the OCSP response is effective, take defaults for clockskew and default validity
peerOpts := certidp.OCSPPeerConfig{ClockSkew: -1, TTLUnsetNextUpdate: -1}View on GitHub (pinned to 3a66a489d2)
Solutions
- Check that the staple actually corresponds to the peer certificate
- Regenerate the staple on the peer from its CA
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/ocsp.go:507 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02).
Data as JSON: /api/errors/30afbb8ae0a9c1f6.
Report an issue: GitHub.