{"record":{"id":"bff0fc36eff4e97c","repo":"openai/codex","slug":"failed-to-redirect-stderr-for-bubblewrap-err","errorCode":null,"errorMessage":"failed to redirect stderr for bubblewrap: {err}","messagePattern":"failed to redirect stderr for bubblewrap: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/linux-sandbox/src/linux_run_main.rs","lineNumber":1448,"sourceCode":"    }\n    let read_fd = pipe_fds[0];\n    let write_fd = pipe_fds[1];\n\n    let pid = unsafe { libc::fork() };\n    if pid < 0 {\n        let err = std::io::Error::last_os_error();\n        panic!(\"failed to fork for bubblewrap: {err}\");\n    }\n\n    if pid == 0 {\n        reset_forwarded_signal_handlers_to_default();\n        setup_signal_mask.restore();\n        // Child: redirect stderr to the pipe, then run bubblewrap.\n        unsafe {\n            close_fd_or_panic(read_fd, \"close read end in bubblewrap child\");\n            if libc::dup2(write_fd, libc::STDERR_FILENO) < 0 {\n                let err = std::io::Error::last_os_error();\n                panic!(\"failed to redirect stderr for bubblewrap: {err}\");\n            }\n            close_fd_or_panic(write_fd, \"close write end in bubblewrap child\");\n        }\n\n        exec_bwrap(args, preserved_files);\n    }\n\n    let signal_forwarders = install_bwrap_signal_forwarders(pid);\n    setup_signal_mask.restore();\n    // Parent: close the write end and read stderr while the child runs.\n    close_fd_or_panic(write_fd, \"close write end in bubblewrap parent\");\n\n    // SAFETY: `read_fd` is a valid owned fd in the parent.\n    let mut read_file = unsafe { File::from_raw_fd(read_fd) };\n    let mut stderr_bytes = Vec::new();\n    let mut limited_reader = (&mut read_file).take(MAX_PREFLIGHT_STDERR_BYTES);\n    if let Err(err) = limited_reader.read_to_end(&mut stderr_bytes) {\n        panic!(\"failed to read bubblewrap stderr: {err}\");","sourceCodeStart":1430,"sourceCodeEnd":1466,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/linux-sandbox/src/linux_run_main.rs#L1430-L1466","documentation":"Error \"failed to redirect stderr for bubblewrap: {err}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:1448 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"}