{"record":{"id":"877e2cafb760d158","repo":"openai/codex","slug":"failed-to-read-bubblewrap-stderr-err","errorCode":null,"errorMessage":"failed to read bubblewrap stderr: {err}","messagePattern":"failed to read bubblewrap stderr: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/linux-sandbox/src/linux_run_main.rs","lineNumber":1466,"sourceCode":"                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}\");\n    }\n\n    let status = wait_for_bwrap_child(pid);\n    let cleanup_signal_mask = ForwardedSignalMask::block();\n    BWRAP_CHILD_PID.store(0, Ordering::SeqCst);\n    cleanup_synthetic_mount_targets(&synthetic_mount_registrations);\n    cleanup_protected_create_targets(&protected_create_registrations);\n    signal_forwarders.restore();\n    cleanup_signal_mask.restore();\n    if libc::WIFSIGNALED(status) {\n        exit_with_wait_status(status);\n    }\n\n    String::from_utf8_lossy(&stderr_bytes).into_owned()\n}\n\n/// Close an owned file descriptor and panic with context on failure.\n///","sourceCodeStart":1448,"sourceCodeEnd":1484,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/linux-sandbox/src/linux_run_main.rs#L1448-L1484","documentation":"Reading bubblewrap's captured stderr from the pipe failed in the parent after the preflight child ran. This panic in run_bwrap_in_child_capture_stderr fires when the read on the pipe errors (EIO on a torn-down pipe, or the child exited leaving the pipe in a bad state), so the diagnostic output explaining bwrap's failure is unavailable.","triggerScenarios":"Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:1466 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the io::Error errno in the message","Re-run the failing sandboxed command to see if the pipe failure recurs","Check for signal-driven teardown interfering with the pipe read","Report as a bug if reproducible, including the command being sandboxed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}