{"id":"154f3bad6b604c01","repo":"redis/redis-py","slug":"failed-to-fetch-issuer-certificate","errorCode":null,"errorMessage":"failed to fetch issuer certificate","messagePattern":"failed to fetch issuer certificate","errorType":"exception","errorClass":"ConnectionError","httpStatus":null,"severity":"error","filePath":"redis/ocsp.py","lineNumber":274,"sourceCode":"\n        # add_certificate returns an initialized OCSPRequestBuilder\n        orb = orb.add_certificate(\n            cert, issuer_cert, cryptography.hazmat.primitives.hashes.SHA256()\n        )\n        request = orb.build()\n\n        path = base64.b64encode(\n            request.public_bytes(hazmat.primitives.serialization.Encoding.DER)\n        )\n        url = urljoin(server, path.decode(\"ascii\"))\n        return url\n\n    def check_certificate(self, server, cert, issuer_url):\n        \"\"\"Checks the validity of an ocsp server for an issuer\"\"\"\n\n        r = requests.get(issuer_url)\n        if not r.ok:\n            raise ConnectionError(\"failed to fetch issuer certificate\")\n        der = r.content\n        issuer_cert = self._bin2ascii(der)\n\n        ocsp_url = self.build_certificate_url(server, cert, issuer_cert)\n\n        # HTTP 1.1 mandates the addition of the Host header in ocsp responses\n        header = {\n            \"Host\": urlparse(ocsp_url).netloc,\n            \"Content-Type\": \"application/ocsp-request\",\n        }\n        r = requests.get(ocsp_url, headers=header)\n        if not r.ok:\n            raise ConnectionError(\"failed to fetch ocsp certificate\")\n        return _check_certificate(issuer_cert, r.content, True)\n\n    def is_valid(self):\n        \"\"\"Returns the validity of the certificate wrapping our socket.\n        This first retrieves for validate the certificate, issuer_url,","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/ocsp.py#L256-L292","documentation":"Error \"failed to fetch issuer certificate\" thrown in redis/redis-py.","triggerScenarios":"Thrown at redis/ocsp.py:274 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}