openai/codex · error

failed to resize console: HRESULT {result}

Error message

failed to resize console: HRESULT {result}

What it means

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

Source

Thrown at codex-rs/windows-sandbox-rs/src/unified_exec/backends/legacy.rs:300

        .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}"
        ))
    }
}

#[allow(clippy::too_many_arguments)]
pub(crate) async fn spawn_windows_sandbox_session_legacy(
    permission_profile: &PermissionProfile,
    workspace_roots: &[AbsolutePathBuf],
    codex_home: &Path,
    command: Vec<String>,
    cwd: &Path,
    mut env_map: HashMap<String, String>,
    timeout_ms: Option<u64>,
    additional_deny_read_paths: &[AbsolutePathBuf],
    additional_deny_write_paths: &[AbsolutePathBuf],
    tty: bool,
    stdin_open: bool,

View on GitHub (pinned to 339751715c)

Solutions

  1. Verify the requested console dimensions are within valid bounds and retry; inspect the HRESULT for the concrete failure.

When it happens

Trigger: Thrown at codex-rs/windows-sandbox-rs/src/unified_exec/backends/legacy.rs:300 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/c0ce2d2079484ffe. Report an issue: GitHub.