openai/codex · error

--apply-seccomp-then-exec is incompatible with…

Error message

--apply-seccomp-then-exec is incompatible with --use-legacy-landlock

What it means

The sandbox helper was invoked with both --apply-seccomp-then-exec and --use-legacy-landlock. This guard in ensure_inner_stage_mode_is_valid fires because the two modes are mutually exclusive by design: the seccomp path re-enters the binary inside bubblewrap for the inner stage, while legacy Landlock applies restrictions directly without the two-stage bwrap flow.

Solutions

  1. Pass only one of --apply-seccomp-then-exec or --use-legacy-landlock
  2. Use the non-legacy path (seccomp after bwrap) on modern kernels
  3. Fix the caller assembling sandbox argv to stop combining the flags
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:377 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/6dce6d2f21e32620. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:377

}

fn resolve_permission_profile(
    permission_profile: Option<PermissionProfile>,
) -> Result<EffectivePermissions, ResolvePermissionProfileError> {
    let permission_profile =
        permission_profile.ok_or(ResolvePermissionProfileError::MissingConfiguration)?;
    let (file_system_sandbox_policy, network_sandbox_policy) =
        permission_profile.to_runtime_permissions();
    Ok(EffectivePermissions {
        permission_profile,
        file_system_sandbox_policy,
        network_sandbox_policy,
    })
}

fn ensure_inner_stage_mode_is_valid(apply_seccomp_then_exec: bool, use_legacy_landlock: bool) {
    if apply_seccomp_then_exec && use_legacy_landlock {
        panic!("--apply-seccomp-then-exec is incompatible with --use-legacy-landlock");
    }
}

fn ensure_legacy_landlock_mode_supports_policy(
    use_legacy_landlock: bool,
    file_system_sandbox_policy: &FileSystemSandboxPolicy,
    network_sandbox_policy: NetworkSandboxPolicy,
    sandbox_policy_cwd: &Path,
) {
    if use_legacy_landlock
        && file_system_sandbox_policy
            .needs_direct_runtime_enforcement(network_sandbox_policy, sandbox_policy_cwd)
    {
        panic!(
            "permission profiles requiring direct runtime enforcement are incompatible with --use-legacy-landlock"
        );
    }
}

View on GitHub (pinned to 339751715c)