{"record":{"id":"fd3c00e2251916d0","repo":"openai/codex","slug":"failed-to-openpty","errorCode":null,"errorMessage":"failed to openpty: {:?}","messagePattern":"failed to openpty: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/utils/pty/src/pty.rs","lineNumber":448,"sourceCode":"    let mut size = libc::winsize {\n        ws_row: size.rows,\n        ws_col: size.cols,\n        ws_xpixel: 0,\n        ws_ypixel: 0,\n    };\n    let winp = std::ptr::addr_of_mut!(size);\n\n    let result = unsafe {\n        libc::openpty(\n            &mut master,\n            &mut slave,\n            std::ptr::null_mut(),\n            std::ptr::null_mut(),\n            winp,\n        )\n    };\n    if result != 0 {\n        anyhow::bail!(\"failed to openpty: {:?}\", std::io::Error::last_os_error());\n    }\n\n    set_cloexec(master)?;\n    set_cloexec(slave)?;\n\n    Ok(unsafe { (File::from_raw_fd(master), File::from_raw_fd(slave)) })\n}\n\n#[cfg(unix)]\nfn set_cloexec(fd: RawFd) -> std::io::Result<()> {\n    let flags = unsafe { libc::fcntl(fd, libc::F_GETFD) };\n    if flags == -1 {\n        return Err(std::io::Error::last_os_error());\n    }\n    let result = unsafe { libc::fcntl(fd, libc::F_SETFD, flags | libc::FD_CLOEXEC) };\n    if result == -1 {\n        return Err(std::io::Error::last_os_error());\n    }","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/utils/pty/src/pty.rs#L430-L466","documentation":"Error \"failed to openpty: {:?}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/utils/pty/src/pty.rs:448 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}