openai/codex · error · std::io::Error

`sandbox_mode` and `permission_profile` overrides cannot…

Error message

`sandbox_mode` and `permission_profile` overrides cannot both be set

What it means

Both `sandbox_mode` and `permission_profile` overrides were supplied for the same session. These two settings define overlapping security posture and conflating them is ambiguous, so config load rejects the combination and asks for exactly one.

Solutions

  1. Set only one of `sandbox_mode` or `permission_profile`.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/core/src/config/mod.rs:3240 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/2313501311a4ecef. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/core/src/config/mod.rs:3240

            compact_prompt,
            show_raw_agent_reasoning,
            tools_web_search_request: override_tools_web_search_request,
            ephemeral,
            bypass_hook_trust,
            additional_writable_roots,
            workspace_roots: workspace_roots_override,
        } = overrides;
        let bypass_hook_trust = bypass_hook_trust.unwrap_or_default();

        if bypass_hook_trust {
            startup_warnings.push(
                "`--dangerously-bypass-hook-trust` is enabled. Enabled hooks may run without review for this invocation."
                    .to_string(),
            );
        }

        if sandbox_mode.is_some() && permission_profile.is_some() {
            return Err(std::io::Error::new(
                std::io::ErrorKind::InvalidInput,
                "`sandbox_mode` and `permission_profile` overrides cannot both be set",
            ));
        }
        if sandbox_mode.is_some() && default_permissions_override.is_some() {
            return Err(std::io::Error::new(
                std::io::ErrorKind::InvalidInput,
                "`sandbox_mode` and `default_permissions` overrides cannot both be set",
            ));
        }
        if permission_profile.is_some() && default_permissions_override.is_some() {
            return Err(std::io::Error::new(
                std::io::ErrorKind::InvalidInput,
                "`permission_profile` and `default_permissions` overrides cannot both be set",
            ));
        }
        if let Some(profile) = cfg.profile.as_deref() {
            return Err(std::io::Error::new(

View on GitHub (pinned to 339751715c)