{"record":{"id":"a4378886a3768081","repo":"openai/codex","slug":"alreadyexists","errorCode":"AlreadyExists","errorMessage":"failed to allocate proxy routing temp dir under {}","messagePattern":"failed to allocate proxy routing temp dir under (.+?)","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/linux-sandbox/src/proxy_routing.rs","lineNumber":325,"sourceCode":"}\n\nfn create_proxy_socket_dir() -> io::Result<PathBuf> {\n    let temp_dir = proxy_socket_parent_dir();\n    let pid = std::process::id();\n    let uid = unsafe { libc::geteuid() };\n    for attempt in 0..128 {\n        let candidate = temp_dir.join(format!(\"{PROXY_SOCKET_DIR_PREFIX}{pid}-{uid}-{attempt}\"));\n        // The bridge UDS paths live under a shared temp root, so the per-run\n        // directory should not be traversable by other processes.\n        let mut dir_builder = DirBuilder::new();\n        dir_builder.mode(0o700);\n        match dir_builder.create(&candidate) {\n            Ok(()) => return Ok(candidate),\n            Err(err) if err.kind() == io::ErrorKind::AlreadyExists => continue,\n            Err(err) => return Err(err),\n        }\n    }\n    Err(io::Error::new(\n        io::ErrorKind::AlreadyExists,\n        format!(\n            \"failed to allocate proxy routing temp dir under {}\",\n            temp_dir.display()\n        ),\n    ))\n}\n\nfn proxy_socket_parent_dir() -> PathBuf {\n    if let Some(codex_home) = std::env::var_os(\"CODEX_HOME\") {\n        let candidate = PathBuf::from(codex_home).join(\"tmp\");\n        if proxy_socket_paths_fit(candidate.as_path())\n            && ensure_private_proxy_socket_parent_dir(candidate.as_path()).is_ok()\n        {\n            return candidate;\n        }\n    }\n    let temp_dir = std::env::temp_dir();","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/linux-sandbox/src/proxy_routing.rs#L307-L343","documentation":"create_proxy_socket_dir could not create a fresh per-run directory for the bridge UDS sockets: all 128 candidate names under the shared temp root are taken (or creation fails, e.g. the temp root is full or not writable). The directory is created with 0o700 mode because it lives under a shared parent traversable by other processes.","triggerScenarios":"Thrown at codex-rs/linux-sandbox/src/proxy_routing.rs:325 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Clear stale codex proxy socket directories left by crashed runs under the temp root and retry","Verify the temp dir (from proxy_socket_parent_dir) exists and is writable by the current uid","If exhaustion is systematic, file a bug to widen the attempt range or prune old directories automatically"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}