openai/codex · error
process is not attached to a PTY
Error message
process is not attached to a PTY
What it means
Error "process is not attached to a PTY" thrown in openai/codex.
Source
Thrown at codex-rs/windows-sandbox-rs/src/unified_exec/backends/legacy.rs:287
CloseHandle(handle);
}
}
if exit_code == 0 {
log_success(&command, logs_base_dir);
} else {
log_failure(&command, &format!("exit code {exit_code}"), logs_base_dir);
}
}
fn resize_conpty_handle(hpc: &Arc<StdMutex<Option<HANDLE>>>, size: TerminalSize) -> Result<()> {
let guard = hpc
.lock()
.map_err(|_| anyhow::anyhow!("failed to lock ConPTY handle"))?;
let hpc = guard
.as_ref()
.copied()
.ok_or_else(|| anyhow::anyhow!("process is not attached to a PTY"))?;
let result = unsafe {
ResizePseudoConsole(
hpc,
COORD {
X: size.cols as i16,
Y: size.rows as i16,
},
)
};
if result == 0 {
Ok(())
} else {
Err(anyhow::anyhow!(
"failed to resize console: HRESULT {result}"
))
}
}
View on GitHub (pinned to 339751715c)
Solutions
- Only perform PTY operations such as resize on exec sessions created with a TTY; start the session with tty enabled.
When it happens
Trigger: Thrown at codex-rs/windows-sandbox-rs/src/unified_exec/backends/legacy.rs:287 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/71a4e009f31c36e1.
Report an issue: GitHub.