openai/codex · error · anyhow::Error
startup CA bundle contained no certificates
Error message
startup CA bundle contained no certificates: {} What it means
read_ca_certificates parsed the startup CA bundle PEM (after normalizing TRUSTED CERTIFICATE blocks) but found zero certificates in it. An explicitly configured CA bundle that contains no certs cannot contribute roots, so loading fails with the file path in the message.
Solutions
- Inspect the bundle file at the reported path and add valid PEM certificates
- Fix the config value pointing at an empty or wrong CA bundle file
- Remove the startup CA bundle setting to rely on platform roots
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/network-proxy/src/certs.rs:339 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- SSL/TLS and certificate errors — how TLS handshakes and certificate validation fail.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/081f6e65371882f2.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/network-proxy/src/certs.rs:339
}
let mut seen = HashSet::new();
certificates.retain(|cert| cert != &managed_ca_cert && seen.insert(cert.as_ref().to_vec()));
Ok(certificates)
}
fn read_ca_certificates(path: &Path) -> Result<Vec<CertificateDer<'static>>> {
let pem = fs::read(path)
.with_context(|| format!("failed to read startup CA bundle: {}", path.display()))?;
let pem = String::from_utf8_lossy(&pem);
let contains_trusted_certificates = pem.contains("TRUSTED CERTIFICATE");
let normalized_pem = pem
.replace("BEGIN TRUSTED CERTIFICATE", "BEGIN CERTIFICATE")
.replace("END TRUSTED CERTIFICATE", "END CERTIFICATE");
let certs = CertificateDer::pem_slice_iter(normalized_pem.as_bytes())
.collect::<std::result::Result<Vec<_>, _>>()
.with_context(|| format!("failed to parse startup CA bundle: {}", path.display()))?;
if certs.is_empty() {
return Err(anyhow!(
"startup CA bundle contained no certificates: {}",
path.display()
));
}
certs
.into_iter()
.map(|cert| {
let cert = if contains_trusted_certificates {
first_der_item(cert.as_ref()).ok_or_else(|| {
anyhow!(
"startup CA bundle contained an invalid trusted certificate: {}",
path.display()
)
})?
} else {
cert.as_ref()
};
Ok(CertificateDer::from(cert.to_vec()))View on GitHub (pinned to 339751715c)