{"record":{"id":"3b21f28339292211","repo":"openai/codex","slug":"failed-to-parse-certificate-certificate-index-f","errorCode":null,"errorMessage":"Failed to parse certificate #{certificate_index} from {} selected by {}: {source}. {hint}","messagePattern":"Failed to parse certificate #(.+?) from (.+?) selected by (.+?): (.+?)\\. (.+?)","errorType":"exception","errorClass":"BuildCustomCaTransportError","httpStatus":null,"severity":"error","filePath":"codex-rs/http-client/src/custom_ca.rs","lineNumber":102,"sourceCode":"        path: PathBuf,\n        source: io::Error,\n    },\n\n    /// The selected CA file was readable, but did not produce usable certificate material.\n    #[error(\n        \"Failed to load CA certificates from {} selected by {}: {detail}. {hint}\",\n        path.display(),\n        source_env,\n        hint = CA_CERT_HINT\n    )]\n    InvalidCaFile {\n        source_env: &'static str,\n        path: PathBuf,\n        detail: String,\n    },\n\n    /// One parsed certificate block could not be registered with the reqwest client builder.\n    #[error(\n        \"Failed to parse certificate #{certificate_index} from {} selected by {}: {source}. {hint}\",\n        path.display(),\n        source_env,\n        hint = CA_CERT_HINT\n    )]\n    RegisterCertificate {\n        source_env: &'static str,\n        path: PathBuf,\n        certificate_index: usize,\n        source: reqwest::Error,\n    },\n\n    /// Reqwest rejected the final client configuration after a custom CA bundle was loaded.\n    #[error(\n        \"Failed to build HTTP client while using CA bundle from {} ({}): {source}\",\n        source_env,\n        path.display()\n    )]","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/http-client/src/custom_ca.rs#L84-L120","documentation":"A single PEM block was parsed but could not be registered as a certificate with the reqwest client builder. This RegisterCertificate variant of BuildCustomCaTransportError fires per-certificate (the index identifies which block in the file failed), typically because the block is malformed or not a valid X.509 certificate even though it was delimited correctly.","triggerScenarios":"Thrown at codex-rs/http-client/src/custom_ca.rs:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the certificate at the reported index in the PEM file and remove or fix malformed blocks","Regenerate the bundle from a trusted source so every CERTIFICATE block is valid X.509","Check each block with `openssl x509 -noout -text -in <block>` to locate the bad certificate","Fall back to system roots by unsetting the env var if the custom bundle is unnecessary"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}