openai/codex · error · anyhow::Error
foreground app-server exited before remote control became…
Error message
foreground app-server exited before remote control became ready
What it means
foreground_app_server_exited_before_ready: the foreground app-server task finished cleanly (Ok(Ok(()))) before remote control reported readiness, i.e. the server shut down early and the readiness handshake can never complete.
Solutions
- Check app-server logs for why it exited early
- Verify the app-server binary/version compatibility
- Retry starting remote control after fixing the shutdown cause
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at codex-rs/cli/src/remote_control_cmd.rs:254 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/a5c7f60c8a551fd2.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/cli/src/remote_control_cmd.rs:254
}
}
Ok(())
}
async fn wait_for_stop_signal(stop_rx: &mut watch::Receiver<bool>) {
if *stop_rx.borrow() {
return;
}
let _ = stop_rx.wait_for(|stopped| *stopped).await;
}
fn foreground_app_server_exited_before_ready(
result: Result<std::io::Result<()>, tokio::task::JoinError>,
) -> anyhow::Error {
match result {
Ok(Ok(())) => {
anyhow::anyhow!("foreground app-server exited before remote control became ready")
}
Ok(Err(error)) => anyhow::Error::new(error)
.context("foreground app-server exited before remote control became ready"),
Err(error) => anyhow::Error::new(error)
.context("foreground app-server task failed before remote control became ready"),
}
}
async fn abort_foreground_app_server(app_server_task: JoinHandle<std::io::Result<()>>) {
app_server_task.abort();
let _ = timeout(FOREGROUND_APP_SERVER_ABORT_TIMEOUT, app_server_task).await;
}
async fn wait_for_foreground_remote_control_ready(
socket_path: AbsolutePathBuf,
) -> anyhow::Result<AppServerRemoteControlReadyStatus> {
codex_app_server_daemon::enable_remote_control_on_socket(
socket_path.as_path(),View on GitHub (pinned to 339751715c)