openai/codex · error · anyhow::Error
UpdateProcThreadAttribute failed
Error message
UpdateProcThreadAttribute failed: {} What it means
UpdateProcThreadAttribute returned zero for one of the attributes being set (PTY handle, job object, pseudoconsole, or handle list); the message embeds the last OS error. Windows refused the attribute value/size pair while preparing the child process.
Solutions
- Inspect the last OS error for the failing attribute (e.g. invalid handle)
- Verify the handle being passed is open and of the right type
- Retry the operation after re-opening the PTY/job handles
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/utils/pty/src/win/procthreadattr.rs:114 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/512d5b87a5073458.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/utils/pty/src/win/procthreadattr.rs:114
unsafe fn update(
&mut self,
attribute: usize,
value: *mut c_void,
size: usize,
) -> Result<(), Error> {
let res = unsafe {
UpdateProcThreadAttribute(
self.as_mut_ptr(),
0,
attribute,
value,
size,
ptr::null_mut(),
ptr::null_mut(),
)
};
ensure!(
res != 0,
"UpdateProcThreadAttribute failed: {}",
IoError::last_os_error()
);
Ok(())
}
}
impl Drop for ProcThreadAttributeList {
fn drop(&mut self) {
unsafe { DeleteProcThreadAttributeList(self.as_mut_ptr()) };
}
}
View on GitHub (pinned to 339751715c)