{"record":{"id":"1a4522f35c7cd74e","repo":"openai/codex","slug":"refusing-to-clear-symlinked-memory-root","errorCode":null,"errorMessage":"refusing to clear symlinked memory root {}","messagePattern":"refusing to clear symlinked memory root (.+?)","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/memories/write/src/control.rs","lineNumber":17,"sourceCode":"use std::path::Path;\n\npub async fn clear_memory_roots_contents(codex_home: &Path) -> std::io::Result<()> {\n    for memory_root in [\n        codex_home.join(\"memories\"),\n        codex_home.join(\"memories_extensions\"),\n    ] {\n        clear_memory_root_contents(memory_root.as_path()).await?;\n    }\n\n    Ok(())\n}\n\npub(crate) async fn clear_memory_root_contents(memory_root: &Path) -> std::io::Result<()> {\n    match tokio::fs::symlink_metadata(memory_root).await {\n        Ok(metadata) if metadata.file_type().is_symlink() => {\n            return Err(std::io::Error::new(\n                std::io::ErrorKind::InvalidInput,\n                format!(\n                    \"refusing to clear symlinked memory root {}\",\n                    memory_root.display()\n                ),\n            ));\n        }\n        Ok(_) => {}\n        Err(err) if err.kind() == std::io::ErrorKind::NotFound => {}\n        Err(err) => return Err(err),\n    }\n\n    tokio::fs::create_dir_all(memory_root).await?;\n\n    let mut entries = tokio::fs::read_dir(memory_root).await?;\n    while let Some(entry) = entries.next_entry().await? {\n        let path = entry.path();\n        let file_type = entry.file_type().await?;","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/memories/write/src/control.rs#L1-L35","documentation":"Error \"refusing to clear symlinked memory root {}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/memories/write/src/control.rs:17 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"}