openai/codex · error · anyhow::Error
managed MITM CA cert path is missing a parent
Error message
managed MITM CA cert path is missing a parent
What it means
persist_managed_ca_trust_bundle found that the managed MITM CA certificate path has no parent directory (Path::parent returned None, e.g. a bare root-relative path). Writing the trust bundle next to the cert is impossible, so the persistence step aborts.
Solutions
- Treat as an internal bug: managed cert paths are always under the codex proxy dir
- Verify the managed CA directory layout has not been corrupted or relocated mid-run
- Report if a legitimate configuration can produce a parentless cert path
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/network-proxy/src/certs.rs:471 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/4e89c30e6b8238ac.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/network-proxy/src/certs.rs:471
};
format!("{:x}", Sha256::digest(trust_bundle)) == expected_hash
}
/// Returns whether `path` points at a current Codex-generated MITM CA bundle.
pub fn is_managed_mitm_ca_trust_bundle_path(path: &str) -> bool {
let Ok(proxy_dir) = managed_ca_dir() else {
return false;
};
is_generated_trust_bundle_path(Path::new(path), &proxy_dir)
}
fn persist_managed_ca_trust_bundle(
managed_ca_cert_path: &Path,
trust_bundle: &str,
) -> Result<PathBuf> {
let proxy_dir = managed_ca_cert_path
.parent()
.ok_or_else(|| anyhow!("managed MITM CA cert path is missing a parent"))?;
fs::create_dir_all(proxy_dir)
.with_context(|| format!("failed to create {}", proxy_dir.display()))?;
let hash = Sha256::digest(trust_bundle.as_bytes());
let trust_bundle_path = proxy_dir.join(format!(
"{MANAGED_MITM_CA_TRUST_BUNDLE_PREFIX}-{hash:x}.pem"
));
write_atomic_create_new_or_reuse(
&trust_bundle_path,
trust_bundle.as_bytes(),
/*mode*/ 0o644,
)
.with_context(|| {
format!(
"failed to persist managed MITM CA trust bundle {}",
trust_bundle_path.display()
)
})?;
Ok(trust_bundle_path)View on GitHub (pinned to 339751715c)