{"record":{"id":"71a4e009f31c36e1","repo":"openai/codex","slug":"process-is-not-attached-to-a-pty-71a4e0","errorCode":null,"errorMessage":"process is not attached to a PTY","messagePattern":"process is not attached to a PTY","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/windows-sandbox-rs/src/unified_exec/backends/legacy.rs","lineNumber":287,"sourceCode":"            CloseHandle(handle);\n        }\n    }\n\n    if exit_code == 0 {\n        log_success(&command, logs_base_dir);\n    } else {\n        log_failure(&command, &format!(\"exit code {exit_code}\"), logs_base_dir);\n    }\n}\n\nfn resize_conpty_handle(hpc: &Arc<StdMutex<Option<HANDLE>>>, size: TerminalSize) -> Result<()> {\n    let guard = hpc\n        .lock()\n        .map_err(|_| anyhow::anyhow!(\"failed to lock ConPTY handle\"))?;\n    let hpc = guard\n        .as_ref()\n        .copied()\n        .ok_or_else(|| anyhow::anyhow!(\"process is not attached to a PTY\"))?;\n    let result = unsafe {\n        ResizePseudoConsole(\n            hpc,\n            COORD {\n                X: size.cols as i16,\n                Y: size.rows as i16,\n            },\n        )\n    };\n    if result == 0 {\n        Ok(())\n    } else {\n        Err(anyhow::anyhow!(\n            \"failed to resize console: HRESULT {result}\"\n        ))\n    }\n}\n","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/unified_exec/backends/legacy.rs#L269-L305","documentation":"Error \"process is not attached to a PTY\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/unified_exec/backends/legacy.rs:287 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Only perform PTY operations such as resize on exec sessions created with a TTY; start the session with tty enabled."],"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"}