openai/codex · error · anyhow::Error

failed to resize console to {}x{}: HRESULT: {}

Error message

failed to resize console to {}x{}: HRESULT: {}

What it means

Error "failed to resize console to {}x{}: HRESULT: {}" thrown in openai/codex.

Source

Thrown at codex-rs/utils/pty/src/win/psuedocon.rs:156

                output.as_raw_handle() as _,
                PSEUDOCONSOLE_RESIZE_QUIRK,
                &mut con,
            )
        };
        ensure!(
            result == S_OK,
            "failed to create psuedo console: HRESULT {result}"
        );
        Ok(Self {
            con,
            _input: input,
            _output: output,
        })
    }

    pub fn resize(&self, size: COORD) -> Result<(), Error> {
        let result = unsafe { (CONPTY.ResizePseudoConsole)(self.con, size) };
        ensure!(
            result == S_OK,
            "failed to resize console to {}x{}: HRESULT: {}",
            size.X,
            size.Y,
            result
        );
        Ok(())
    }

    pub fn spawn_command(&self, cmd: CommandBuilder) -> anyhow::Result<WinChild> {
        let job = Arc::new(JobObject::create()?);
        let mut si: STARTUPINFOEXW = unsafe { mem::zeroed() };
        si.StartupInfo.cb = mem::size_of::<STARTUPINFOEXW>() as u32;
        si.StartupInfo.dwFlags = STARTF_USESTDHANDLES;
        si.StartupInfo.hStdInput = INVALID_HANDLE_VALUE;
        si.StartupInfo.hStdOutput = INVALID_HANDLE_VALUE;
        si.StartupInfo.hStdError = INVALID_HANDLE_VALUE;

View on GitHub (pinned to 339751715c)

When it happens

Trigger: Thrown at codex-rs/utils/pty/src/win/psuedocon.rs:156 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/31b2e81eb6dd15a2. Report an issue: GitHub.