{"record":{"id":"3ec1e6db56e32639","repo":"openai/codex","slug":"context-err","errorCode":null,"errorMessage":"{context}: {err}","messagePattern":"\\{context\\}: \\{err\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/linux-sandbox/src/linux_run_main.rs","lineNumber":1492,"sourceCode":"    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///\n/// We use explicit close() checks here (instead of ignoring return codes)\n/// because this code runs in low-level sandbox setup paths where fd leaks or\n/// close errors can mask the root cause of later failures.\nfn close_fd_or_panic(fd: libc::c_int, context: &str) {\n    let close_res = unsafe { libc::close(fd) };\n    if close_res < 0 {\n        let err = std::io::Error::last_os_error();\n        panic!(\"{context}: {err}\");\n    }\n}\n\nfn is_proc_mount_failure(stderr: &str) -> bool {\n    stderr.contains(\"Can't mount proc\")\n        && stderr.contains(\"/newroot/proc\")\n        && (stderr.contains(\"Invalid argument\")\n            || stderr.contains(\"Operation not permitted\")\n            || stderr.contains(\"Permission denied\"))\n}\n\nstruct InnerSeccompCommandArgs<'a> {\n    sandbox_policy_cwd: &'a Path,\n    command_cwd: Option<&'a Path>,\n    permission_profile: &'a PermissionProfile,\n    allow_network_for_proxy: bool,\n    proxy_route_spec: Option<String>,\n    command: Vec<String>,","sourceCodeStart":1474,"sourceCodeEnd":1510,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/linux-sandbox/src/linux_run_main.rs#L1474-L1510","documentation":"A close() on an owned file descriptor failed during low-level sandbox setup. This panic in close_fd_or_panic fires with the caller-supplied context naming which fd was being closed; explicit close checks are used deliberately in these paths because swallowed close errors (EINTR/EBADF) would mask the root cause of later failures in the pipe/fd choreography around bwrap.","triggerScenarios":"Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:1492 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the context string in the message to identify which fd lifecycle failed","Check the errno for EBADF (double close / premature close) versus EINTR","Review the pipe setup path named by the context for fd-handling bugs","Report as a bug with the context and errno"],"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"}