openai/codex · error · std::io::Error
app-server control socket is already in use at
Error message
app-server control socket is already in use at {} What it means
AlreadyExists io::Error from prepare_control_socket_path: a probe connect to the Unix control socket succeeded, meaning another live app-server instance already owns the socket at that path. A second bind would steal or break the first instance, so startup refuses with this error naming the path.
Solutions
- Stop the other running app-server instance or use a different socket path for this instance
- If truly stale, remove the socket file manually — but only after confirming no live listener
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/app-server-transport/src/transport/unix_socket.rs:100 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/13bea25eae8fd666.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/app-server-transport/src/transport/unix_socket.rs:100
warn!("failed to upgrade control socket websocket connection: {err}");
return;
}
};
let (websocket_writer, websocket_reader) = websocket_stream.split();
run_websocket_connection(websocket_writer, websocket_reader, transport_event_tx).await;
});
}
info!("control socket acceptor shutting down");
}
pub async fn prepare_control_socket_path(socket_path: &Path) -> IoResult<()> {
if let Some(parent) = socket_path.parent() {
codex_uds::prepare_private_socket_directory(parent).await?;
}
match UnixStream::connect(socket_path).await {
Ok(_stream) => {
return Err(std::io::Error::new(
ErrorKind::AddrInUse,
format!(
"app-server control socket is already in use at {}",
socket_path.display()
),
));
}
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()? {View on GitHub (pinned to 339751715c)