{"record":{"id":"f2fdcdcedb6996d3","repo":"openai/codex","slug":"error-applying-legacy-linux-sandbox-restrictions","errorCode":null,"errorMessage":"error applying legacy Linux sandbox restrictions: {e:?}","messagePattern":"error applying legacy Linux sandbox restrictions: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/linux-sandbox/src/linux_run_main.rs","lineNumber":332,"sourceCode":"            &sandbox_policy_cwd,\n            command_cwd.as_deref(),\n            &file_system_sandbox_policy,\n            network_sandbox_policy,\n            inner,\n            !no_proc,\n            allow_network_for_proxy,\n        );\n    }\n\n    // Legacy path: Landlock enforcement only, when bwrap sandboxing is not enabled.\n    if let Err(e) = apply_permission_profile_to_current_thread(\n        &permission_profile,\n        &sandbox_policy_cwd,\n        /*apply_landlock_fs*/ true,\n        allow_network_for_proxy,\n        /*proxy_routed_network*/ false,\n    ) {\n        panic!(\"error applying legacy Linux sandbox restrictions: {e:?}\");\n    }\n    exec_or_panic(command);\n}\n\n#[derive(Debug, Clone)]\nstruct EffectivePermissions {\n    permission_profile: PermissionProfile,\n    file_system_sandbox_policy: FileSystemSandboxPolicy,\n    network_sandbox_policy: NetworkSandboxPolicy,\n}\n\n#[derive(Debug, PartialEq, Eq)]\nenum ResolvePermissionProfileError {\n    MissingConfiguration,\n}\n\nimpl fmt::Display for ResolvePermissionProfileError {\n    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/linux-sandbox/src/linux_run_main.rs#L314-L350","documentation":"The legacy Landlock-only enforcement path failed to apply sandbox restrictions to the current thread. This panic in run_main fires on the fallback path (used when bubblewrap sandboxing is not enabled) when apply_permission_profile_to_current_thread with Landlock enabled returns an Err, meaning the filesystem/network rules could not be installed and the command must not run unsandboxed.","triggerScenarios":"Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:332 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the embedded error to identify whether Landlock rule creation or network enforcement failed","Verify the kernel supports Landlock (Linux 5.13+) and the required Landlock ABI version","Prefer the non-legacy bwrap path if the environment supports it","Report with kernel version if restrictions fail on supported kernels"],"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"}