{"record":{"id":"255dcb4e71384624","repo":"openai/codex","slug":"runner-pipe-closed-before-spawn-request","errorCode":null,"errorMessage":"runner: pipe closed before spawn_request","messagePattern":"runner: pipe closed before spawn_request","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/windows-sandbox-rs/src/bin/command_runner/win.rs","lineNumber":186,"sourceCode":"    if let Ok(mut guard) = writer.lock() {\n        write_frame(&mut *guard, &msg)?;\n    }\n    Ok(())\n}\n\nfn windows_error_code(err: &anyhow::Error) -> Option<u32> {\n    err.chain().find_map(|cause| {\n        cause\n            .downcast_ref::<std::io::Error>()\n            .and_then(std::io::Error::raw_os_error)\n            .and_then(|code| u32::try_from(code).ok())\n    })\n}\n\n/// Read and validate the initial spawn request frame.\nfn read_spawn_request(reader: &mut File) -> Result<SpawnRequest> {\n    let Some(msg) = read_frame(reader)? else {\n        anyhow::bail!(\"runner: pipe closed before spawn_request\");\n    };\n    if msg.version != IPC_PROTOCOL_VERSION {\n        anyhow::bail!(\"runner: unsupported protocol version {}\", msg.version);\n    }\n    match msg.message {\n        Message::SpawnRequest { payload } => Ok(*payload),\n        other => anyhow::bail!(\"runner: expected spawn_request, got {other:?}\"),\n    }\n}\n\nfn read_acl_mutex_exists() -> Result<bool> {\n    let name = to_wide(OsStr::new(READ_ACL_MUTEX_NAME));\n    let handle = unsafe { OpenMutexW(MUTEX_ALL_ACCESS, 0, name.as_ptr()) };\n    if handle == 0 {\n        let err = unsafe { GetLastError() };\n        if err == ERROR_FILE_NOT_FOUND {\n            return Ok(false);\n        }","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/bin/command_runner/win.rs#L168-L204","documentation":"Error \"runner: pipe closed before spawn_request\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/bin/command_runner/win.rs:186 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}