openai/codex · error · std::io::Error
terminal input stream closed during startup
Error message
terminal input stream closed during startup
What it means
The terminal event stream feeding StartupDraftRunner ended (the events source returned None) while a startup future was still being polled in run_until, so input can no longer be received and startup cannot continue meaningfully.
Solutions
- Let startup fail and exit the TUI with this error
- Reopen/reinitialize the terminal input event source
- Check for crossterm/tty errors that caused the stream to close
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/tui/src/startup_draft.rs:216 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/40119ca630948791.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/tui/src/startup_draft.rs:216
}
Ok(())
}
/// Poll one existing startup future alongside the original terminal input stream.
pub(crate) async fn run_until<F>(&mut self, tui: &mut Tui, future: F) -> io::Result<F::Output>
where
F: Future,
{
if self.initial_screen == StartupDraftInitialScreen::Composer {
self.draw(tui, tui.terminal.last_known_screen_size)?;
}
tokio::pin!(future);
loop {
tokio::select! {
output = &mut future => return Ok(output),
event = self.events.next() => {
let Some(event) = event else {
return Err(io::Error::new(
io::ErrorKind::UnexpectedEof,
"terminal input stream closed during startup",
));
};
self.handle_event(tui, event)?;
}
}
}
}
/// Preserve pending draft edits while continuing to reject startup actions and submission.
pub(crate) async fn flush_pending_events(&mut self, tui: &mut Tui) -> io::Result<()> {
loop {
for _ in 0..STARTUP_EVENT_BATCH_SIZE {
let Poll::Ready(Some(event)) = std::future::poll_fn(|context| {
Poll::Ready(self.events.as_mut().poll_next(context))
})
.awaitView on GitHub (pinned to 339751715c)