openai/codex · error · anyhow::Error
managed MITM CA certificate path is missing a file name
Error message
managed MITM CA certificate path is missing a file name
What it means
lock_managed_ca_certificate could not derive a lock file name because the managed CA certificate path ends in a component with no file name. This is a defensive guard on a path that is normally constructed as PREFIX-hash.pem under the proxy dir, so hitting it implies an unexpected path shape.
Solutions
- Treat as an internal invariant failure: check how the cert path was constructed
- Restore the standard managed CA directory layout under codex home
- Report a bug if a valid path can trigger this guard
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/network-proxy/src/certs.rs:530 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/eaa7dbba2d83efd7.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/network-proxy/src/certs.rs:530
bundle.push_str("-----END CERTIFICATE-----\n");
}
fn persist_managed_ca_certificate(proxy_dir: &Path, cert_pem: &str) -> Result<PathBuf> {
let hash = Sha256::digest(cert_pem.as_bytes());
let cert_path = proxy_dir.join(format!("{MANAGED_MITM_CA_CERT_PREFIX}-{hash:x}.pem"));
write_atomic_create_new_or_reuse(&cert_path, cert_pem.as_bytes(), /*mode*/ 0o644)
.with_context(|| {
format!(
"failed to persist managed MITM CA certificate {}",
cert_path.display()
)
})?;
Ok(cert_path)
}
fn lock_managed_ca_certificate(certificate_path: &Path) -> Result<File> {
let lock_path = managed_ca_certificate_lock_path(certificate_path)
.ok_or_else(|| anyhow!("managed MITM CA certificate path is missing a file name"))?;
let file = open_managed_ca_lock(&lock_path)?;
file.lock_shared()
.with_context(|| format!("failed to lock {}", lock_path.display()))?;
Ok(file)
}
fn lock_managed_ca_artifacts(proxy_dir: &Path) -> Result<File> {
let lock_path = proxy_dir.join(MANAGED_MITM_CA_ARTIFACT_LOCK);
let file = open_managed_ca_lock(&lock_path)?;
file.lock()
.with_context(|| format!("failed to lock {}", lock_path.display()))?;
Ok(file)
}
fn managed_ca_certificate_lock_path(certificate_path: &Path) -> Option<PathBuf> {
let file_name = certificate_path.file_name()?.to_string_lossy();
Some(certificate_path.with_file_name(format!(".{file_name}.lock")))
}View on GitHub (pinned to 339751715c)