openai/codex · error · std::io::Error
app-server control socket path exists and is not a socket
Error message
app-server control socket path exists and is not a socket: {} What it means
AlreadyExists io::Error from prepare_control_socket_path: the path exists, is not recognized as a stale socket, and the metadata check says it is not a Unix socket file (some other file/directory occupies the path). The acceptors cannot bind a non-socket path, so startup aborts with the offending path in the message.
Solutions
- Move or delete the file occupying the socket path, then restart
- Point the control socket at a dedicated, empty directory so it cannot collide with user files
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/app-server-transport/src/transport/unix_socket.rs:123 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/1db33fe3613b82a4.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/app-server-transport/src/transport/unix_socket.rs:123
),
));
}
Err(err) if err.kind() == ErrorKind::NotFound => return Ok(()),
Err(err) if err.kind() == ErrorKind::ConnectionRefused => {}
Err(err) => {
if !socket_path.exists() {
return Ok(());
}
return Err(err);
}
}
if !socket_path.try_exists()? {
return Ok(());
}
if !codex_uds::is_stale_socket_path(socket_path).await? {
return Err(std::io::Error::new(
ErrorKind::AlreadyExists,
format!(
"app-server control socket path exists and is not a socket: {}",
socket_path.display()
),
));
}
tokio::fs::remove_file(socket_path).await
}
pub struct AppServerStartupLock {
_file: std::fs::File,
}
pub async fn acquire_app_server_startup_lock(
startup_lock_path: AbsolutePathBuf,
) -> IoResult<AppServerStartupLock> {
if let Some(parent) = startup_lock_path.as_path().parent() {View on GitHub (pinned to 339751715c)