openai/codex · error · io::Error
TimedOut
TimedOut
Error message
timed out discarding buffered terminal input
What it means
discard_pending_terminal_input failed to fully drain decoded and unread terminal input within its one-second deadline before showing a security-sensitive screen; partial control sequences may still be buffered and could be misinterpreted as user input.
Solutions
- Retry draining the input buffer
- Abort the sensitive screen/prompt rather than proceeding with queued keystrokes
- Log and surface the issue so the user can restart the TUI
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at codex-rs/tui/src/tui/input_boundary.rs:36 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/38b0ff6149ab9358.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/tui/src/tui/input_boundary.rs:36
fn drop(&mut self) {
if self.active {
let _ = super::restore_after_exit();
}
}
}
/// Drain decoded and unread input before a screen can accept a security-sensitive decision.
///
/// Partial control sequences remain quarantined; an unresolved boundary fails after one second.
pub(crate) fn discard_pending_terminal_input() -> Result<()> {
#[cfg(unix)]
let _ = crossterm::event::discard_buffered_input()?;
let deadline = Instant::now() + Duration::from_secs(/*secs*/ 1);
loop {
let remaining = deadline.saturating_duration_since(Instant::now());
if remaining.is_zero() {
return Err(io::Error::new(
io::ErrorKind::TimedOut,
"timed out discarding buffered terminal input",
));
}
if crossterm::event::poll(remaining.min(Duration::from_millis(/*millis*/ 10)))? {
let _ = crossterm::event::read()?;
continue;
}
#[cfg(unix)]
if crossterm::event::discard_buffered_input()?
!= crossterm::event::InputDiscardStatus::Complete
{
continue;
}
#[cfg(any(unix, windows))]View on GitHub (pinned to 339751715c)