openai/codex · error · anyhow::Error
CreatePipe stdin failed
Error message
CreatePipe stdin failed: {} What it means
CreatePipe returned zero while allocating the stdin pipe pair for the sandboxed child, so no input stream could be set up. Commonly caused by resource exhaustion (too many open handles) or invalid security attributes.
Solutions
- Check the GetLastError value in the message for the exact cause
- Reduce open handle counts if the process is exhausting resources
- Retry pipe creation after a brief delay for transient failures
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at codex-rs/windows-sandbox-rs/src/process.rs:243 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/ffbaa4f372428d6a.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/windows-sandbox-rs/src/process.rs:243
h_token: HANDLE,
argv: &[String],
cwd: &Path,
env_map: &HashMap<String, String>,
stdin_mode: StdinMode,
stderr_mode: StderrMode,
console_mode: ConsoleMode,
use_private_desktop: bool,
logs_base_dir: Option<&Path>,
) -> Result<PipeSpawnHandles> {
let mut in_r: HANDLE = 0;
let mut in_w: HANDLE = 0;
let mut out_r: HANDLE = 0;
let mut out_w: HANDLE = 0;
let mut err_r: HANDLE = 0;
let mut err_w: HANDLE = 0;
unsafe {
if CreatePipe(&mut in_r, &mut in_w, ptr::null_mut(), 0) == 0 {
return Err(anyhow!("CreatePipe stdin failed: {}", GetLastError()));
}
if CreatePipe(&mut out_r, &mut out_w, ptr::null_mut(), 0) == 0 {
CloseHandle(in_r);
CloseHandle(in_w);
return Err(anyhow!("CreatePipe stdout failed: {}", GetLastError()));
}
if matches!(stderr_mode, StderrMode::Separate)
&& CreatePipe(&mut err_r, &mut err_w, ptr::null_mut(), 0) == 0
{
CloseHandle(in_r);
CloseHandle(in_w);
CloseHandle(out_r);
CloseHandle(out_w);
return Err(anyhow!("CreatePipe stderr failed: {}", GetLastError()));
}
}
let stderr_handle = match stderr_mode {View on GitHub (pinned to 339751715c)