openai/codex · error · anyhow::Error
refusing to reuse symlink
Error message
refusing to reuse symlink {} What it means
write_atomic_create_new_or_reuse found the destination path is a symbolic link. Reusing or replacing a symlink would write through it to an attacker-chosen target, so managed CA artifacts must be regular files and the operation refuses.
Solutions
- Remove the symlink at the reported path
- Audit the managed CA directory for tampering
- Retry so a regular file is created in its place
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/network-proxy/src/certs.rs:766 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/2a4f7ca4a27857b9.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/network-proxy/src/certs.rs:766
#[cfg(not(windows))]
fn sync_parent_dir(parent: &Path) -> Result<()> {
// Best-effort durability: ensure the directory entry is persisted too.
let dir = File::open(parent).with_context(|| format!("failed to open {}", parent.display()))?;
dir.sync_all()
.with_context(|| format!("failed to fsync {}", parent.display()))
}
#[cfg(windows)]
fn sync_parent_dir(_parent: &Path) -> Result<()> {
Ok(())
}
fn write_atomic_create_new_or_reuse(path: &Path, contents: &[u8], mode: u32) -> Result<()> {
if fs::symlink_metadata(path)
.ok()
.is_some_and(|metadata| metadata.file_type().is_symlink())
{
return Err(anyhow!("refusing to reuse symlink {}", path.display()));
}
if fs::read(path).ok().as_deref() == Some(contents) {
return Ok(());
}
if path.exists() {
return Err(anyhow!(
"refusing to reuse existing mismatched file {}",
path.display()
));
}
match write_atomic_create_new(path, contents, mode) {
Ok(()) => Ok(()),
Err(_err) if fs::read(path).ok().as_deref() == Some(contents) => Ok(()),
Err(err) => Err(err),
}
}
#[cfg(unix)]View on GitHub (pinned to 339751715c)