{"record":{"id":"8687333db6ce4a47","repo":"nats-io/nats-server","slug":"failed-to-get-issuer-certificate-for-s-peer","errorCode":null,"errorMessage":"failed to get issuer certificate for %s peer","messagePattern":"failed to get issuer certificate for (.+?) peer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/ocsp.go","lineNumber":501,"sourceCode":"\t\t// Check whether need to verify staples from a peer router or gateway connection.\n\t\tswitch kind {\n\t\tcase kindStringMap[ROUTER], kindStringMap[GATEWAY]:\n\t\t\ttc.VerifyConnection = func(s tls.ConnectionState) error {\n\t\t\t\toresp := s.OCSPResponse\n\t\t\t\tif oresp == nil {\n\t\t\t\t\treturn fmt.Errorf(\"%s peer missing OCSP Staple\", kind)\n\t\t\t\t}\n\n\t\t\t\t// Peer connections will verify the response of the staple.\n\t\t\t\tif len(s.VerifiedChains) == 0 {\n\t\t\t\t\treturn fmt.Errorf(\"%s peer missing TLS verified chains\", kind)\n\t\t\t\t}\n\n\t\t\t\tchain := s.VerifiedChains[0]\n\t\t\t\tpeerLeaf := chain[0]\n\t\t\t\tpeerIssuer := certidp.GetLeafIssuerCert(chain, 0)\n\t\t\t\tif peerIssuer == nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to get issuer certificate for %s peer\", kind)\n\t\t\t\t}\n\n\t\t\t\t// Response signature of issuer or issuer delegate is checked in the library parse\n\t\t\t\tresp, err := ocsp.ParseResponseForCert(oresp, peerLeaf, peerIssuer)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to parse OCSP response from %s peer: %w\", kind, err)\n\t\t\t\t}\n\n\t\t\t\t// If signer was issuer delegate double-check issuer delegate authorization\n\t\t\t\tif resp.Certificate != nil {\n\t\t\t\t\tok := false\n\t\t\t\t\tfor _, eku := range resp.Certificate.ExtKeyUsage {\n\t\t\t\t\t\tif eku == x509.ExtKeyUsageOCSPSigning {\n\t\t\t\t\t\t\tok = true\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif !ok {","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/ocsp.go#L483-L519","documentation":"Peer-verification callback: no issuer certificate could be located in the peer's verified chain (certidp.GetLeafIssuerCert returned nil), so the OCSP response signature cannot be validated against an issuer.","triggerScenarios":"Thrown at server/ocsp.go:501 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Have the peer send its intermediate certificates so the issuer is in the chain","Adjust trust settings so the full chain is available for verification"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}