openai/codex · error

separate stderr handle should be present

Error message

separate stderr handle should be present

What it means

Error "separate stderr handle should be present" thrown in openai/codex.

Source

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

    } else {
        let pipe_handles = spawn_process_with_pipes(
            h_token,
            command,
            cwd,
            env_map,
            if stdin_open {
                StdinMode::Open
            } else {
                StdinMode::Closed
            },
            StderrMode::Separate,
            ConsoleMode::Inherit,
            use_private_desktop,
            logs_base_dir,
        )?;
        let stdout_join = spawn_output_reader(pipe_handles.stdout_read, stdout_tx);
        let Some(stderr_read) = pipe_handles.stderr_read else {
            anyhow::bail!("separate stderr handle should be present");
        };
        let Some(stderr_tx) = stderr_tx else {
            anyhow::bail!("separate stderr channel should be present");
        };
        let stderr_join = spawn_output_reader(stderr_read, stderr_tx);
        let output_join = std::thread::spawn(move || {
            let _ = stdout_join.join();
            let _ = stderr_join.join();
        });
        let writer_handle = spawn_input_writer(
            pipe_handles.stdin_write,
            writer_rx,
            /*normalize_newlines*/ false,
        );
        (
            pipe_handles.process,
            pipe_handles.job(),
            output_join,

View on GitHub (pinned to 339751715c)

Solutions

  1. Request a separate stderr pipe when starting the exec session instead of merging stderr into stdout; otherwise treat it as an internal bug and retry.

When it happens

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