openai/codex · error
error applying Linux sandbox restrictions
Error message
error applying Linux sandbox restrictions: {e:?} What it means
Applying Landlock/no-new-privileges/network restrictions to the sandbox thread failed during setup. This panic in run_main fires when apply_permission_profile_to_current_thread returns an Err (Landlock unsupported, rule creation rejected, or network policy enforcement failure), meaning the filesystem/network isolation the sandbox promises could not be installed before exec; the debug-formatted error is included.
Solutions
- Read the embedded error to see whether Landlock or network enforcement failed
- Check kernel Landlock support (Linux 5.13+; use --use-legacy-landlock only where appropriate)
- Verify the filesystem policy paths are accessible and well-formed
- Report with kernel version if enforcement fails on a supported system
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:239 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/dd4c2e9dd7e3137a.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:239
}
if allow_network_for_proxy {
let spec = proxy_route_spec
.as_deref()
.unwrap_or_else(|| panic!("managed proxy mode requires --proxy-route-spec"));
if let Err(err) = activate_proxy_routes_in_netns(spec) {
panic!("error activating Linux proxy routing bridge: {err}");
}
}
let proxy_routing_active = allow_network_for_proxy;
if let Err(e) = apply_permission_profile_to_current_thread(
&permission_profile,
&sandbox_policy_cwd,
/*apply_landlock_fs*/ false,
allow_network_for_proxy,
proxy_routing_active,
) {
panic!("error applying Linux sandbox restrictions: {e:?}");
}
let signal_mask = ForwardedSignalMask::block();
let command_pid = unsafe { libc::fork() };
if command_pid < 0 {
let err = std::io::Error::last_os_error();
panic!("failed to fork sandboxed command: {err}");
}
if command_pid == 0 {
reset_forwarded_signal_handlers_to_default();
signal_mask.restore();
exec_or_panic(command);
}
let signal_forwarders = install_bwrap_signal_forwarders(command_pid);
signal_mask.restore();
loop {View on GitHub (pinned to 339751715c)