{"record":{"id":"2a4f7ca4a27857b9","repo":"openai/codex","slug":"refusing-to-reuse-symlink","errorCode":null,"errorMessage":"refusing to reuse symlink {}","messagePattern":"refusing to reuse symlink (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/network-proxy/src/certs.rs","lineNumber":766,"sourceCode":"#[cfg(not(windows))]\nfn sync_parent_dir(parent: &Path) -> Result<()> {\n    // Best-effort durability: ensure the directory entry is persisted too.\n    let dir = File::open(parent).with_context(|| format!(\"failed to open {}\", parent.display()))?;\n    dir.sync_all()\n        .with_context(|| format!(\"failed to fsync {}\", parent.display()))\n}\n\n#[cfg(windows)]\nfn sync_parent_dir(_parent: &Path) -> Result<()> {\n    Ok(())\n}\n\nfn write_atomic_create_new_or_reuse(path: &Path, contents: &[u8], mode: u32) -> Result<()> {\n    if fs::symlink_metadata(path)\n        .ok()\n        .is_some_and(|metadata| metadata.file_type().is_symlink())\n    {\n        return Err(anyhow!(\"refusing to reuse symlink {}\", path.display()));\n    }\n    if fs::read(path).ok().as_deref() == Some(contents) {\n        return Ok(());\n    }\n    if path.exists() {\n        return Err(anyhow!(\n            \"refusing to reuse existing mismatched file {}\",\n            path.display()\n        ));\n    }\n    match write_atomic_create_new(path, contents, mode) {\n        Ok(()) => Ok(()),\n        Err(_err) if fs::read(path).ok().as_deref() == Some(contents) => Ok(()),\n        Err(err) => Err(err),\n    }\n}\n\n#[cfg(unix)]","sourceCodeStart":748,"sourceCodeEnd":784,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/network-proxy/src/certs.rs#L748-L784","documentation":"Error \"refusing to reuse symlink {}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/network-proxy/src/certs.rs:766 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}