openai/codex · error · BuildCustomCaTransportError

Failed to register certificate #

Error message

Failed to register certificate #{certificate_index} from {} selected by {} in rustls root store: {source}. {hint}

What it means

A parsed PEM certificate block could not be added to the rustls RootCertStore while assembling TLS configuration for the websocket/reqwest transport. It fires at root-store insertion time for the certificate at the given index, usually because the block is not a decodable X.509 certificate (expired, wrong type, or corrupt DER payload); the env var and path identify the bundle it came from.

Solutions

  1. Remove or regenerate the certificate block at the reported index in the PEM bundle
  2. Verify each block decodes with `openssl x509 -noout -text` before including it
  3. Re-export the chain from the issuing CA in clean PEM format
  4. Unset the CA env vars to fall back to system roots
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/http-client/src/custom_ca.rs:133 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/44844b3bc54e605f. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/http-client/src/custom_ca.rs:133

    /// Reqwest rejected the final client configuration after a custom CA bundle was loaded.
    #[error(
        "Failed to build HTTP client while using CA bundle from {} ({}): {source}",
        source_env,
        path.display()
    )]
    BuildClientWithCustomCa {
        source_env: &'static str,
        path: PathBuf,
        #[source]
        source: reqwest::Error,
    },

    /// Reqwest rejected the final client configuration while using only system roots.
    #[error("Failed to build HTTP client while using system root certificates: {0}")]
    BuildClientWithSystemRoots(#[source] reqwest::Error),

    /// One parsed certificate block could not be registered with the websocket TLS root store.
    #[error(
        "Failed to register certificate #{certificate_index} from {} selected by {} in rustls root store: {source}. {hint}",
        path.display(),
        source_env,
        hint = CA_CERT_HINT
    )]
    RegisterRustlsCertificate {
        source_env: &'static str,
        path: PathBuf,
        certificate_index: usize,
        source: rustls::Error,
    },
}

impl From<BuildCustomCaTransportError> for io::Error {
    fn from(error: BuildCustomCaTransportError) -> Self {
        match error {
            BuildCustomCaTransportError::ReadCaFile { ref source, .. } => {
                io::Error::new(source.kind(), error)

View on GitHub (pinned to 339751715c)